[Chicago] newbie says HI; needs help

Andrew Dudzik adudzik at gmail.com
Fri Jan 20 17:58:04 CET 2006


> This sort of gets to the distinction of "readability" versus
> "terseness".  Even though that "hack" is just one line, it's much
> harder to read and comprehend than the four line version that Andrew
> mentioned earlier.
>

Yes--nobody should ever, ever write code like that... please forget that
ever happened.

It has been pointed out to me that the right one-liner is this:

(2,1)[texture in ["flakey","caked"]]

This isn't easy to read for someone unfamiliar with Python, but it can be
more readily translated as "if the expression doesn't hold, do this,
otherwise, do this."
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/chicago/attachments/20060120/53d346b9/attachment.html 


More information about the Chicago mailing list