"Data blocks" syntax specification draft
bartc
bc at freeuk.com
Wed May 23 06:17:15 EDT 2018
On 23/05/2018 07:03, Chris Angelico wrote:
> On Wed, May 23, 2018 at 3:32 PM, Christian Gollwitzer <auriocus at gmx.de> wrote:
>> I'd think that the definitive answer is in the grammar, because that is what
>> is used to build the Python parser:
>>
>> https://docs.python.org/3/reference/grammar.html
>>
>> Actually, I'm a bit surprised that tuple, list etc. does not appear there as
>> a non-terminal. It is a bit hard to find, and it seems that "atom:" is the
>> starting point for parsing tuples, lists etc.
>>
>
> The grammar's a bit hard to read for this sort of thing, as the only
> hint of semantic meaning is in the labels at the beginning. For
> example, there's a "dictorsetmaker" entry that grammatically could be
> a dict comp or a set comp; distinguishing them is the job of other
> parts of the code.
Looking at all the instances of "','" (and there are plenty), none of
them are tied to anything to do with tuples. Actually 'tuple' doesn't
appear at all.
'dict' does, presumably because a dict-constructor is different
syntactically in requiring key:value pairs.
--
bartc
More information about the Python-list
mailing list