james_027 a écrit : > Hi, > > what if we're not dealing with dict? is there a pythonic way of doing > ternary? the bool ? x:y
Python 2.5 introduced the following syntax: expr1 if condition else expr2 In older Python versions, one has to use and/or (like you wrongly did) or tuple/dict dispatch or other ad-hoc tricks. Or use a plain old if/else branch. -- http://mail.python.org/mailman/listinfo/python-list