|
 |
Darren New wrote:
> Kevin Wampler wrote:
>> This isn't *quite* correct, since a single comma can construct either
>> a 1-tuple or a 2-tuple depending on how it's used:
>
> Right. That's the weirdness of it, including the fact that there are
> other uses for the comma (like between function arguments) as well.
This seems to be (for better or worse) sort of the python philosophy of
language design, and as far as I can tell they at least seem to be
consistent about when they are inconsistent. It reminds me of how they
parse expressions with comparison operators specially so you can type
"if a < b < c:" and have it work. It's simple to understand on a
"human" level, but it's definitely a special case in how the syntax is
parsed.
Post a reply to this message
|
 |