[Python-ideas] Python Users Aren't Perfect
Ned Batchelder
ned at nedbatchelder.com
Mon Dec 12 14:00:28 CET 2011
On 12/10/2011 9:42 AM, Oleg Broytman wrote:
> On Sat, Dec 10, 2011 at 02:16:21PM +0000, Richard Prosser wrote:
>> Although I love Python there are some aspects of the language design which
>> are disappointing and which can even lead to problems in some cases.
> What really is disappointing is the number of people who criticize
> Python without knowing it.
>
>> Another awkward 'feature' is the requirement for a trailing comma in
>> singleton tuples, due I believe to the use of expression parentheses rather
>> than (say) the use of special brackets like chevrons.
> You do not understand the syntax. Parens do not construct tuples -
> commas do. So for every tuple - even of length 1 - you must have a
> comma. The only exception is an empty tuple (of length 0).
I don't think we have to go as far as blaming the user. Tuple syntax is
a little tricky, people often trip up on (x,) as a single-item tuple.
You and I understand why it is, and there isn't a better alternative,
but that one-item syntax sticks out when compared to the others: (), (x,
y), (x, y, z), etc. This is a true "gotcha" as Richard originally
expressed it.
> Oleg.
--Ned.
More information about the Python-ideas
mailing list