If One Line
alex23
wuwei23 at gmail.com
Fri Dec 26 01:45:57 EST 2014
More information about the Python-list mailing list
Fri Dec 26 01:45:57 EST 2014
- Previous message (by thread): If One Line
- Next message (by thread): If One Line
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 26/12/2014 1:37 PM, Steven D'Aprano wrote: >> One approach is to use a function in the condition to do the assignment: > > Let me fix that for you: > > /s/approach/bad idea/ I never said it was a _good_ approach ;) > And you don't even save any lines! Instead of a one-liner, you have six > lines! While I'm _definitely_ not going to advocate for this approach as a valid solution, I have to disagree with this being an issue. While it's more lines in the given example, if there were dozens of such assignment-within-conditional calls in the same code, the additional LOCs become negligible. > Just because a programming language allows something doesn't make it a good > idea. This is true. But conversely, just because I think something is a bad idea doesn't mean someone else can't have found a valid use for it.
- Previous message (by thread): If One Line
- Next message (by thread): If One Line
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list