[Python-Dev] Re: Shorthand for lambda (original) (raw)
Bob Ippolito bob at redivi.com
Wed Mar 23 19:51:18 CET 2005
- Previous message: [Python-Dev] Re: Shorthand for lambda
- Next message: [Python-Dev] Re: Shorthand for lambda
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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.) Though i must say i have no idea what you are trying to do here. If you filter on False, you'll always get an empty list.
Similarly, appscript provides function versions of operators named such as AND and OR. I suppose there could be a length one as well (in AppleScript terminology, it would be called count), or you could technically denote it as len(), but that's quite ugly.
I had implemented something quite similar to this a long time ago, but considered it "evil" and never used it for anything:
-bob
- Previous message: [Python-Dev] Re: Shorthand for lambda
- Next message: [Python-Dev] Re: Shorthand for lambda
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]