Is it explicitly specified?

André Malo auch-ich-m at g-kein-spam.com
Tue Feb 5 05:03:19 EST 2008


* George Sakkis wrote:

> On Feb 4, 6:53 am, André Malo <auch-ic... at g-kein-spam.com> wrote:
>> Consider the function being part of a bigger system, where it's called
>> from another function or method which should "inherit" the default value
>> of the function, like:
>>
>> def g(foo, bar, x=None):
>>    ...
>>    f(x=x)
>>
>> Now if you change the default value of f(x) for some reason, you don't
>> have to wind up all the possible caller signatures to reflect that
>> change.
> 
> You might find handy a decorator I've written exactly for this
> scenario, reusing default arguments across functions:
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/440702

Although it's limited to certain use cases and hence not applicable in all
the situations, it's a very nice idea :-)

nd
-- 
Winnetous Erbe: <http://pub.perlig.de/books.html#apache2>



More information about the Python-list mailing list