Let's Talk About Lambda Functions!
Jonathan Hogg
jonathan at onegoodidea.com
Tue Jul 30 08:21:56 EDT 2002
On 30/7/2002 12:29, in article ukcu02su9a7r5b at news.supernews.com, "John
Roth" <johnroth at ameritech.net> wrote:
> Why bother with the restrictions? Fredrik had the right idea when
> he said that we needed something to make it obvious that functions
> are first class objects. That is, allow anonamous functions anywhere
> you can have a function object.
How far does one go? Classes are first-class objects, should we also have
anonymous classes?
>>> foo = (class:
... def __init__( self, x y ):
... self.x = x
... self.y = y
... )( 5, 6 )
>>>
>>> foo.x
5
>>>
I'm a fan of lambda, but when a function is complex enough that it can't be
done in an in-(one-)line lambda then it should be pulled out and given a
name.
Jonathan
More information about the Python-list
mailing list