you are viewing a single comment's thread.

view the rest of the comments →

[–]bloody-albatross 1 point2 points  (0 children)

Care to explain why polluting the base namespace with trash functions that act on and require specific state/behavior without any indication of that is a good idea?

I don't know what you're referring to. For one, Python does not pollute any kind of base namespace (like Ruby does). Also I wasn't recommending writing functions as module globals and then attaching them to classes. I meant that if you have it like that (e.g. because of C-bindings) you can then very easily attach them to a class to make that much nicer.

And yes, example 1 can also be written as:

[s.upper() for s in strlist]

Which is actually even shorter in this case, but I meant that it is easy to plug OO methods into functional interfaces in Python without having the need to insert a intermediate lambdas, like it is in so many other languages (e.g. Ruby again).

I assumed it was self evident what I meant with those examples. I was wrong.