make order of function definitions irrelevant
antonmuhin.REMOVE.ME.FOR.REAL.MAIL at rambler.ru
Mon Nov 10 21:33:04 CET 2003
Peter Hansen wrote:
> anton muhin wrote:
>> As was said, you usually don't need such a thing. If you desperatly
>>looking for it, something like this might work:
>>func = None
>> assert func, 'func is None'
>> return func()
>> return 'foo'
>> return 'bar'
>>func = foo
>>Of course, in this case you'd better pass an actual function as a
>>parameter. But, again, almost for sureit's a flaw in your design.
> As it stands, the first line in the above code is still redundant,
> and can be removed with no ill effects, as "func" is not actually
> called until it is bound to a real function.
Sure, thanks. It just a little bit clearer.
More information about the Python-list