Python Module: nift

Chris Rebert clp2 at rebertia.com
Sun Feb 8 13:53:57 EST 2009


On Sun, Feb 8, 2009 at 10:42 AM, J <seaworthyjeremy at gmail.com> wrote:
> What are your thoughts on this module I created?

* You should probably use individual docstrings for each function
rather than one giant module docstring
* Don't use 'list' as a variable name; it shadows the name of the
builtin list type
* You can use the .lower() or .upper() method of strings to get rid of
half the 'or'-s in leet() and reet(). Better yet, use a dict rather
than a long if-elif chain.
* To convert a list of strings to a single string, use
''.join(the_list) instead of:
final = ''
for letters in the_list:
    final = final + letters #also, += is preferred in cases like this
* To convert a string to a list of characters, use list(string) instead of:
the_list = []
final = ''
for letters in string:
    the_list.append(letters)

Cheers,
Chris

-- 
Follow the path of the Iguana...
http://rebertia.com



More information about the Python-list mailing list