[Python-Dev] Re: anonymous blocks
sabbey at u.washington.edu
Tue Apr 19 22:06:44 CEST 2005
Fredrik Lundh wrote:
>> In short, if doFoo is defined like:
>> def doFoo(func1, func2):
>> You would be able to call it like:
>> def func1(a, b):
>> return a + b
>> def func2(c, d):
>> return c + d
>> That is, a suite can be used to define keyword arguments.
> umm. isn't that just an incredibly obscure way to write
> def func1(a, b):
> return a + b
> def func2(c, d):
> return c + d
> doFoo(func1, func2)
> but with more indentation?
If suites were commonly used as above to define properties, event handlers
and other callbacks, then I think most people would be able to comprehend
what the first example above is doing much more quickly than the second.
So, I don't find it obscure for any reason other than because no one does
Also, the two examples above are not exactly the same since the two
functions are defined in a separate namespace in the top example.
More information about the Python-Dev