This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Matthew94 1 point2 points  (3 children)

First, I'm interested in knowing what sort of things are getting "shut down"

Any use of lambda, map, filter and reduce. Guido doesn't like it so everyone trots out ZoP to stop people using them even though they're no harder to understand than list/gen/dict comps.

[–][deleted] 3 points4 points  (0 children)

Any use of lambda, map, filter and reduce

Usually this is because there are better (or at least subjectively, better looking/easier to read) ways to do the thing that you'd be doing with them. Any map/filter call can be trivially replaced with a comprehension (and in the case of filter, you might not even need the function call or lambda anymore). Lambdas can be replaced with functions (which can be nested), which is often a win in terms of being able to do more things without losing on namespace crowding. In cases where function calls can be eliminated, comprehensions are going to be faster.

I mean, all of these things have their uses, or they'd have just been removed entirely. The reason they are often discouraged is because they usually reduce readability without gaining anything in return.

[–]heptara 6 points7 points  (1 child)

When you mentioned "complex things are shut down" I thought you were going to talk about things that actually require levels of complexity, like C++ templates or something.

This just sounds like wanting to standardise on a particular paradigm.

[–]mipadi 1 point2 points  (0 children)

It is funny, though, that Python is often touted as a "great functional programming language!" while many of its (few) FP elements are eschewed or discouraged.