On Apr 10, 2005 7:18 AM, Dick Moores <[EMAIL PROTECTED]> wrote: > I'm a newbie, but would this qualify as a contribution to UselessPython 2.0?
Hello Dick, don't be shy, or do you suspect it might be too usefull? ;-) I found it funny, so it must be good enough. here my remarks: > def makeStringAllLowercaseAlpha(s): > """ > Take any string, convert all uppercase alphabetic characters to > lower case, > then strip all non-alphabetic characters [what's bad about non-alphabetic characters?] > """ > s1 = string.lower(userstring) oops: this function gets an argument s, here you're using the global variable userstring. I know, it works, but there will be functions were mistakes like this weren't just ugly but buggy. > s2 = "" > for index in range(len(s1)): > if s1[index] in string.ascii_lowercase: > s2 += s1[index] or easier (much more readable, helps understanding the programm): for char in s1: if char in string.ascii_lowercase: s2 += char regards Michael _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor