4 ms·
Yeah, I don't think you know python very well at all given your criticisms. The very first thing you criticize is "its reliance on mutable data structures"--uhh
by moonshinefe 10y ago
Yeah, I don't think you know python very well at all given your criticisms. The very first thing you criticize is "its reliance on mutable data structures"--uhh no, most data structures and types in python are immutable.
I'll at least agree I've met a lot of python snobs who say don't use the built in map/filter functions and things like that in favour of comprehensions, but that's hardly representative of the language.
And please. List comprehensions can be nested, just like every other language can be abused if you really want to try.
- FrederikNS 10y agoMost semi-primitive types in python is immutable, yes (int, float, char, str, and DateTime), but all of the collections are mutable (List, Dict, Set). I'm sure there are immutable versions of those same data structures hidden somewhere in the standard library, but I haven't looked. I did stumble upon pyrsistent (https://github.com/tobgu/pyrsistent https://github.com/tobgu/pyrsistent) a while ago which does provide proper immutable (and persistent) data structures for python.
- crdoconnor 10y agoI usually treat them as immutable by using copy(x) or deepcopy(x) unless I'm writing a chunk of code that is explicitly building it from scratch and pushing it somewhere.