comprehensions was Re: Switch statements again

Jp Calderone exarkun at intarweb.us
Sun Jan 19 22:38:09 EST 2003


On Sun, Jan 19, 2003 at 06:24:23PM -0800, Erik Max Francis wrote:
> [snip]
> 
> People don't really commonly use the (p and [x] or [y])[0] trick, do
> they?

  Commonly?  No, I don't believe so.  Commonly, I use:

  if p:
    x
  else:
    y

  Occassionally I use the above trick, though.  It is useful as the body of
a callback lambda, for example.

  Jp

--
 12:00am up 34 days, 9:48, 3 users, load average: 0.23, 0.25, 0.22
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20030119/3b080f4d/attachment.sig>


More information about the Python-list mailing list