[Chicago] newbie says HI; needs help

Ian Bicking ianb at colorstudy.com
Fri Jan 20 18:06:06 CET 2006

Andrew Dudzik wrote:
>     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"]]

In Python 2.5 you'll be able to do:

   1 if texture in ['flakey', 'caked'] else 2

Ian Bicking  /  ianb at colorstudy.com  /  http://blog.ianbicking.org

More information about the Chicago mailing list