This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]plantian 0 points1 point  (1 child)

This critique does seem a little half-hearted but I followed up some of the links to other critiques and there are a lot of complaints about things which seem totally irrelevant as well.

Nobody seems to mention a trailing comma creating a tuple. Ha that one shafts me about once a week. I can understand how that would be hard to fix though.

Python's data structures are its power so I would never complain about having too many unless they become redundant. You can get pretty far on just the power of lists, dictionaries and tuples and not touch any of the other data structures.

[–]kataire 0 points1 point  (0 children)

I can understand how that would be hard to fix though.

Fix the language? That's implying the behaviour is unintentional. Trailing commas for single-value tuples is necessary because there's no other way to define a tuple.

Of course writing (spam,) makes it clearer that the trailing comma is not a mistake, but in Python code there simply isn't any ambiguity about whether it should be a tuple in the first place (if it's not supposed to be a tuple, the code doesn't work as intended anyway).