Writing "pythonish" code

Istvan Albert istvan.albert at gmail.com
Fri Feb 2 10:04:09 EST 2007


On Feb 2, 6:20 am, Mizipzor <mizip... at gmail.com> wrote:


> Now, the thing that bothers me the most. When I write python modules I
> write one class per file, and the file and the class has a common
> name. Maybe this is due to c++ habits.

Python modules typically contain multiple classes and module level
functions as well. That way having to deal with redundant names such
as  foo.foo comes up less often.

Also it is a good habit to make capitalize class names, that way
writing:

from foo import Foo, bar

makes it clear that one is a class the other a function.

i.

PS: here is my personal pet peeve ...  say it out loud ... I love the
functionality it offers and saved me a lot of work, yet I have to make
his conscious effort to keep these  names:  package, module, class
apart.

from elementtree.ElementTree import ElementTree




More information about the Python-list mailing list