3 ms·
_But_ the addition would be useless in practice because this problem almost never arises in real code. Its only purpose would be to answer Lisp and Ruby advocat
by abstractbill 16y ago
_But_ the addition would be useless in practice because this problem almost never arises in real code. Its only purpose would be to answer Lisp and Ruby advocates who want to say that Python doesn't really have closures.
A great example of the Blub paradox in action ;)
- btilly 16y agoA great example of the Blub paradox in action ;) Actually not. There is no code you can write using closures modifying external state that cannot be trivially rewritten in Python using a one-element array in the outer scope which you modify in the inner (without assigning). Therefore Python has that feature in effect. It just doesn't have a piece of dedicated syntax for it.
- ubernostrum 16y agoYeah, and Haskell programmers love having it pointed out that their language makes them stupid by not allowing them to do this ;) Oh wait. Nobody says that about Haskell programmers? They only say it about Python? Huh. When they both have this same shortcoming with their so-called "closures"? Wonder why that is?
- jpr 16y agoNot allowing what? Rebinding of variables? That's what IORefs, MVars etc. are for.
- chromatic 16y agoAnyone who's reached that point with Haskell is comfortable with the idea of immutable state. Anyone who's reached that point with Python is very comfortable with the idea of mutable state... everywhere else.
- ubernostrum 16y agoWhich is funny, because in both cases they're symptoms of trade-offs made in the language design. But a Haskell programmer who understands this and decides to accept it is just considered normal. A Python programmer who understands this and decides to accept it (as in the linked post) is declared to be a Blub user, which is essentially a polite-enough-for-HN way to say "LOL STOOPID NOOOB".
- olavk 16y agoI believe it is a rare example of a symmetrical Blub paradox. We know objects are a poor mans closures, just as closures are poor mans objects.