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="bonono, post: 1849356"] this makes me "jump" from the list comprehension to the function, harder to follow than 'in place', especially when the function is simple, it is not necessary. What is the reason for introducing list comprehension and then later, generator expression when : a=[] for x in range(8): a.append(describe(x%2)) return a and for x in range(8): yield describe(x%2) can do the same thing ? Doesn't it violate the general idiom that it better has one and only one way to do certain thing ? I believe part of the reason is that one doesn't need to "jump" up and down. Now that is obsession for(and bad use of) one-liner. But picking a bad example of one liner to rule out its effectiveness and readability is a stretch I would say. [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Python
the PHP ternary operator equivalent on Python
Top