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 | ncoghlan at gmail.com | Brisbane, Australia --------------------------------------------------------------- http://boredomandlaziness.blogspot.com
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4