3 ms·
Arrogant bullshit, probably the worst non-spam comment I’ve seen on HN—congrats. https://peps.python.org/pep-0671/ https://peps.python.org/pep-0671/ Truth is,
by mixmastamyk 3y ago
Arrogant bullshit, probably the worst non-spam comment I’ve seen on HN—congrats.
https://peps.python.org/pep-0671/ https://peps.python.org/pep-0671/
Truth is, early vs late binding is a tradeoff. Python picked one, but not like the other is without edge cases either.
- colejohnson66 3y agoGP's point is that Python didn’t “pick” one but that it’s probably an accident of how the parser was implemented. It would see the `[]`, allocate a new object, then greedily assign it to the “variable”. The whole “tradeoff” argument doesn’t make sense when you consider that Python is the odd one out here with early binding. In fact, there’s been so many bugs with it that they had to invent a whole new syntax to fix it. When one says `intParam += 2`, why should they expect that to modify the default parameter? Yet when the default is a list, all of a sudden it’s fine. Python breaks the principle of least astonishment with default parameters, and it’s frustrating hearing people defend such a thing.
- mixmastamyk 3y agoThe point is that it wasn't an accident. It was picked for performance reasons. And Python isn't the only one that does it. Don't remember the exact list but it was given once in a python-dev thread regarding the mentioned pep.
- chlorion 3y agoI don't understand what's getting you all bent out of shape about this. Unexpected emergent behaviors are extremely common in programming language design. Even when carefully planning every language feature, unexpected interactions can and do occur, sometimes these things are not ideal. I am not very informed about Python's history here, but it's not far fetched that this behavior was not planned and just happened due to unexpected interactions of other features. Why would Python be immune to this? Are Guido and the rest of the Python contributors 1000x devs that can see infinitely far into the future and never make mistakes? All of Pythons quirks were actually planned from the very beginning I guess.
- mixmastamyk 3y agoIt was chosen, I listened to the debate around the pep. Go is talking out their ass.
- mixmastamyk 3y agoIt was chosen, I listened to the debate around the pep. GP is talking out their ass.
- crabbone 3y agoWhat does this trash have to do with my comment?