
Jan. 31, 2007
1:54 a.m.
Piotr Duda wrote:
Read my previous post again, and give me examples of what you cannot do regarding default arguments.
First, I'd like to register my dislike for implicitly determining when a default argument will be copied on every call. Second, as per your request: def foo(bar=None): if bar is None: bar = function_call() #code def foo(bar=None): if bar is None: bar = something.method_call() #code #These were just a few. There are others. These cannot be rewritten using simple copying decorators. Various decorators have been presented that account for some of these (and other) situations. However, IMHO they're not too elegant/clean. Thus, a slightly more sophisticated solution is required. - Chris Rebert