News for hackers. Stuff that matters.
Re:PEP 308 and why I still hate Python by Animats on Thursday March 09, 2017 @09:11PM (#13835764)
Python is an imperative language. The control structure, based on indentation, is well matched to Python's imperative character. Attempts to retrofit a functional style to Python fit Python's syntax badly. Lambdas, conditionals, and list comprehensions look painful if they extend beyond one line, because the indentation assumptions of Python just don't fit.

As a practical matter, only use Python's functional features in one-liners.

Re:PEP 308 and why I still hate Python by userbinator on Thursday March 09, 2017 @09:57PM (#13835967)
Python is an imperative language.

...as are many others with the conditional operator's operands in the normal (condition, true-case, false-case) order:

https://en.wikipedia.org/wiki/%3F:

I think being "functional" or otherwise has nothing to do with it. Even in imperative languages you must use expressions, and it is there that the conditional operator is most useful.

Re:PEP 308 and why I still hate Python by pjvandehaar on Monday March 13, 2017 @09:28PM (#13864198)
Re:PEP 308 and why I still hate Python by jolux on Thursday March 09, 2017 @10:13PM (#13836027)
Yeah, this has nothing to do with FP. No idea what the parent was going for...
Re:PEP 308 and why I still hate Python by nsaslideface on Thursday March 09, 2017 @09:56PM (#13835962)
Indeed. I find the huge "some_method" example pretty much invalid because I'd assign that dict to a variable first, so the line would be a nicer "return my_dict if y else {}". What person, style guide or PEP is forcing anyone to write some_method's return statement?

I don't get the ideal of saving space and writing huge one-liners (that in Python you'd have to break up over more lines). As they say on IRC: "if you're worried about using too many lines, I can send you a file full of blank ones."

Re:PEP 308 and why I still hate Python by Lazare on Thursday March 09, 2017 @11:51PM (#13836462)
You've identified a real issue (the functional features work badly except as one liners), and a good fix (only use them as one liners).

I think the cause has everything to do with some poor choices around the parser and syntax, however, and nothing to do with its imperative nature as such.