language-x-isms

Bryan belred at gmail.com
Thu Jun 8 05:52:00 CEST 2006


does anyone know if there is a collection somewhere of common python mistakes or 
inefficiencies or unpythonic code that java developers make when first starting 
out writing python code? if not, maybe we could start a thread on this.

for example, i've noticed several java developers i know write python code like 
this:

foo_list = [...]
for i in range(len(foo_list)):
    print '%d %s' % (i, foo_list[i])


of course, one way to do this would be to use enumerate:

for i, foo in enumerate(foo_list):
     print '%d %s' % (i, foo)


i'm guessing there is a lot of these language-x-isms that people on this list 
have seen. i think it would be helpful to both the new java-to-python developer 
and python developers in general to be aware of these.

just an idea.
feel free to discuss any language-x-isms, not necessarily just java-isms.

bryan




More information about the Python-list mailing list