Best place for a function?

bearophileHUGS at bearophileHUGS at
Wed Mar 7 23:57:54 CET 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).


More information about the Python-list mailing list