[SciPy-dev] Best ways to set default values consistent within a module
David Cournapeau
david at ar.media.kyoto-u.ac.jp
Sat Jun 9 06:46:49 EDT 2007
Hi,
I have a question concerning default values for scipy functions.
Basically, I have a class which have a significant number of function,
several private, several private, and they provide different levels of
the same functionality, with similar arguments with default values.
class foo:
def foo1(level = def1, dim = def2):
pass
def foo2(level = def1, dim = def2):
pass
What is the best way to maintain the default values consistent ? What I
do for now is to set the default values from global variables; another
way is to use the syntax *args, **kw, but I don't really like it myself,
because then you do not know what the values when doing help foo.foo1 (I
found this really annoying in matplotlib docstrings, for example).
cheers,
David
More information about the SciPy-Dev
mailing list