|
For me personally, the biggest pain points that drove me to Python were: 1. Sigils, and relatedly, contexts. In my opinion, `my $length = @list;` is a horrid way to spell `length = len(list)`. It feels too much like typecasting magic. 2. Having to opt in to pass by reference caused so much pain. You're happily passing a hash around, but then you want to do something to it, so now you have to change the type signature of the function, then everything that calls it, etc. etc. Contrast with Python, where everything is pass-by-object-reference and sigils aren't needed because contexts in the Perl sense don't exist. This worked on my first try: >>> a = ["foo", 123, {"bar": [(1,2,3), {"qux": "quux"}]}]
>>> a[2]["bar"][1]["spam"] = "eggs"
>>> import json
>>> json.dumps(a)
I liked Perl. I wrote a lot of Perl. And yet, I still had to pull out The Book whenever I wanted to do anything more complex than passing a couple of ints or strings around. This stuff is knowable, obviously, but I just got tired of having to know it. |
To do this in Python is truly grim:
and thats doing it the unpythonic way, if you were to do this like the typical Python dev would accept in an MR for a large corp you would have written: They would still hate you for defaultdict(datastructure) though. Because absolutely no one in Python realises its got that level of expressionism one of the few places it does.