Best place for a function?

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Wed Mar 7 17:57:54 EST 2007


Diez B. Roggisch:
> If it really has no other use as in this class, put it as an
> instancemethod in there. Alternatively, you _could_ nest it like this:

Using an instancemethod may be the most formally correct solution for
that problem, but often nested function are the simpler solution. A
downside of nested functions is that you can't give them a doctest (in
a simple way).

Bye,
bearophile




More information about the Python-list mailing list