PEP 308: I liked the original proposal better
Dave Brueck
dave at pythonapocrypha.com
Mon Feb 24 11:46:06 EST 2003
More information about the Python-list mailing list
Mon Feb 24 11:46:06 EST 2003
- Previous message (by thread): PEP 308: I liked the original proposal better
- Next message (by thread): PEP 308: I liked the original proposal better
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Mon, 24 Feb 2003, Delaney, Timothy C (Timothy) wrote: > > From: Greg Ewing (using news.cis.dfn.de) [mailto:me at privacy.net] > > > > As far as I can see, no one proposal appears to have > > anywhere near a majority supporting it, and the minority > > which supports x if C else y doesn't seem to be > > significantly smaller than the minority supporting > > any other single proposal. > > > > I just feel that it has been dismissed too soon. > > Nah - they've all been dismissed too late. > > The One True Pythonic Ternary Operator is > > class bool: > > def ifelse (self, trueresult, falseresult, callable=False): > if self: > if callable: > return trueresult() > else: > return trueresult > else: > if callable: > return falseresult() > else: > return falseresult > > Short-circuiting and everything else required in one. > > this-was-going-to-be-a-wink-but-I-like-this-idea-ly yours Better put the wink back in. :) Unfortunately, it doesn't provide short circuiting for any of the times when short-circuiting is actually important - it's unlikely that a parameterless function call would be that useful, not to mention the more common uses like preventing invalid attribute access, preventing divide by zero, etc. :( -Dave
- Previous message (by thread): PEP 308: I liked the original proposal better
- Next message (by thread): PEP 308: I liked the original proposal better
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list