[SciPy-dev] Best ways to set default values consistent within a module

David Cournapeau david@ar.media.kyoto-u.ac...
Sat Jun 9 05:46:49 CDT 2007


    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):
    def foo2(level = def1, dim = def2):
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).



More information about the Scipy-dev mailing list