[Python-Dev] Re: Shorthand for lambda

2005-03-23 Thread Reinhold Birkenfeld
Ka-Ping Yee wrote: > On Wed, 23 Mar 2005, Reinhold Birkenfeld wrote: >> What does you implementation do for this: >> >> >>> somevar = False >> >>> filter(_ and False, numbers) > > It fails. (For the same reason that __len__ doesn't work -- > Python insists that __nonzero__ must return an int.) T

Re: [Python-Dev] Re: Shorthand for lambda

2005-03-23 Thread Bob Ippolito
On Mar 23, 2005, at 1:16 PM, Ka-Ping Yee wrote: On Wed, 23 Mar 2005, Reinhold Birkenfeld wrote: What does you implementation do for this: somevar = False filter(_ and False, numbers) It fails. (For the same reason that __len__ doesn't work -- Python insists that __nonzero__ must return an int.) T

Re: [Python-Dev] Re: Shorthand for lambda

2005-03-23 Thread Ka-Ping Yee
On Wed, 23 Mar 2005, Reinhold Birkenfeld wrote: > What does you implementation do for this: > > >>> somevar = False > >>> filter(_ and False, numbers) It fails. (For the same reason that __len__ doesn't work -- Python insists that __nonzero__ must return an int.) Though i must say i have no idea

[Python-Dev] Re: Shorthand for lambda

2005-03-23 Thread Reinhold Birkenfeld
Ka-Ping Yee wrote: > It dawned on me that you could use this idea to make the whole > filter/lambda experience vastly more pleasant. I whipped up a quick > implementation: > > >>> from placeholder import _ > >>> numbers = [5, 9, 56, 34, 1, 24, 37, 89] > >>> filter(_ < 30, numbers) >