jamesr wrote: > Congragulations heartily given. I missed the ternary op in c... Way to > go! clean and easy and now i can do: > > if ((sys.argv[1] =='debug') if len(sys.argv) > 1 else False): > pass > > and check variables IF AND ONLY if they exist, in a single line! > > but y'all knew that..
Yep, it was a conscious decision to add a construct with the *potential* to be abused for use in places where the existing "and" and "or" expressions *are* being abused and resulting in buggy code. The code in your example is lousy because it's unreadable (and there are far more readable alternatives like a simple short-circuiting usage of "and"), but at least it's semantically correct (whereas the same can't be said for the current abuse of "and" and "or"). If code using a conditional expression is unclear, blame the programmer for choosing to write the code, don't blame the existence of the conditional expression :) We're-all-adults-here-ly yours, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --------------------------------------------------------------- http://boredomandlaziness.blogspot.com _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com