3 ms·
As a sibling to my other comment: Python is not less surprising, when programming in a JS style. `nonlocal` is crazy. That lambdas may only be a single line is
by jakear 8y ago
As a sibling to my other comment: Python is not less surprising, when programming in a JS style.
`nonlocal` is crazy. That lambdas may only be a single line is annoying. Being unable to print anything out of a map or filter operation without first converting to a list gets tedious quick. And not being able to go in for a quick monkey patch on repr, because builtin classes are magically different than user defined classes in “some way”, which makes modifying them prohibited, is limiting.
Sure, the easy retort is: that’s not what you should be doing anyways, python just enforces it. But I’d personally hate to see such an argument in the comment section of SICP, the pinnacle of programmer freedom.
Edit: and what about mutable default parameters?? I’ve had a fair amount of experience with python and sill been bitten by a mutable default parameter bug (not quite that, but related) in the past couple months. JS gets rid of that entirely by making them just syntactic sugar for what it would do anyways, which is much easier to reason about.
- jakear 8y agoThe bug I had was declaring variables in the body of a class without `self.`. Turns out that makes them static. Ironically similar to JS making non prefixed declarations global, except I received no in editor warnings about that, and it wasn’t something beaten into my head from the day I started. Edit: or was it that I initialized them at time of declaration rather than in the constructor? Not sure. Something along those lines.
- hannofcart 8y agoMost of the issues I find people annoyed with in JS are becoming less of an issue with modern idiomatic JS that is less object oriented, more functional and with ES6 utilities replacing more troublesome legacy idioms. I work on a fairly large app that uses little no classes. Also, I haven't had to use hasOwnProperty in a year! I just use Object.keys()