3 ms·
There's some annoyances that have accumulated in python, like the inheritance patterns and too many underscored things. Decorators are kinda weird, too. I thi
by mlyle 7y ago
There's some annoyances that have accumulated in python, like the inheritance patterns and too many underscored things. Decorators are kinda weird, too.
I think Python is pretty awesome, but to pretend that it's super clean is a bit of a stretch.
(a,) for a single-elem tuple-- avoiding colliding with (a) as a paren'd expression-- is wonky, too.
- dijit 7y agoI think there exists a lot of space between being “not a great programming language” and “not being super clean” though.
- dual_basis 7y agoFor the single element tuple case - what else would you suggest? You can always do Tuple(3) instead of (3,) if you'd like.
- mlyle 7y agoCould use something other than parens for bracketing tuples, so you don't have the conflict with the order-of-operations use of parens.
- dual_basis 7y agoSuch as? All the brackets are currently spoken for: [] = list {} = set / dict <, > = less / greater than I suppose you could overload <, > but I'm not sure that's much better. Honestly, the more I've learned different languages the more I've come to the conclusion that little syntax changes like this are minor, for the most part, and what really changes the power and feel of a language are the abstractions that it allows for.
- mlyle 7y ago<> avoids syntactic ambiguity just fine-- There won't be an identifier or constant before it. <1,2,3> <1> and <> are all plausible-looking and you don't need to guess how to do 1 element or 0 element things if you know <1,2,3>. > Honestly, the more I've learned different languages the more I've come to the conclusion that little syntax changes like this are minor, for the most part, Sure, it's minor. But it's one of the few things I tripped over learning python and had to google repeatedly to get to stick in my head. The fact that python has relatively few cases of weirdness like this-- compared to say, perl-- is a big part of what makes python nice.
- eesmith 7y agoThe tuple notation is one of those places where the obvious way is a distraction. A non-empty tuple doesn't need the ()s - it's the "," which makes the tuple! The following two are equivalent: x = 1, x = (1,) Of course, then there's no way to express the empty tuple using commas, which is where () comes in. Using (a,) is the belts-and-suspenders way of saying "this is a 1 element tuple".