4 ms·
For the single element tuple case - what else would you suggest? You can always do Tuple(3) instead of (3,) if you'd like.
by dual_basis 7y ago
For 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.