Diez B. Roggisch <[EMAIL PROTECTED]> wrote:
>  Michael >>
> >> Does Python 2.4 support it?
> > 
> > Not precisely, but you can *usually* get away with:
> > 
> > a and b or c
> 
>  This is really bad advice, as long as you don't explain why it "usually"
>  works (and often enough not). This for example won't work:
> 
> >>> False or '' and 0
> ''

You can use this if you want it to be bullet proof

  (a and [b] or [c])[0]

Not exactly elegant though!

-- 
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to