"abcd" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

>x = None
> result = (x is None and "" or str(x))
>
> ...what's wrong with the first operation I did with x?  I was expecting
> "result" to be an empty string, not the str value of None.

Your evil tertiary hack has failed you because the empty string
counts as false in a boolean context. Please learn to love the
new conditional expression syntax:

http://docs.python.org/whatsnew/pep-308.html 


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to