"Data blocks" syntax specification draft

bartc bc at freeuk.com
Tue May 22 19:51:36 EDT 2018


On 22/05/2018 16:57, Chris Angelico wrote:
> On Wed, May 23, 2018 at 1:43 AM, Ian Kelly <ian.g.kelly at gmail.com> wrote:

>> In other words, the rule is not really as simple as "commas make
>> tuples". I stand by what I wrote.
> 
> Neither of us is wrong here.

Sorry, but I don't think you're right at all. unless the official 
references for the language specifically say that commas are primarily 
for constructing tuples, and all other uses are exceptions to that rule.

AFAICS, commas are used just like commas everywhere - used as 
separators. The context tells Python what the resulting sequence is.

  "Commas make tuples" is a useful
> oversimplification in the same way that "asterisk means
> multiplication" is. The asterisk has other meanings in specific
> contexts (eg unpacking), but outside of those contexts, it means
> multiplication.

I don't think that's quite right either. Asterisk is just an overloaded 
token but you will what it's for as soon as it's encountered.

Comma seems to be used only as a separator.


-- 
bartc



More information about the Python-list mailing list