Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Python
the PHP ternary operator equivalent on Python
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Fredrik Lundh, post: 1850440"] the OP's question was How you do this in a practic way without the use of one-line code ? the OPs code contains five reads and three writes, my and steven's versions contain four reads and three writes. the yet-to-be-released ternary operator would remove one read from the OPs code, which makes both alternatives equivalent. dictionary accesses don't involve passes over the dictionary. there's a comment on readability and code understanding waiting to be made here, but I'll leave that for another day. </F> [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Python
the PHP ternary operator equivalent on Python
Top