On Sat, Oct 15, 2016 at 8:45 PM Chris Angelico <ros...@gmail.com> wrote:

> On Sun, Oct 16, 2016 at 4:38 AM, אלעזר <elaz...@gmail.com> wrote:
> > On Sat, Oct 15, 2016 at 8:36 PM Chris Angelico <ros...@gmail.com> wrote:
> >>
> >> On Sun, Oct 16, 2016 at 4:33 AM, אלעזר <elaz...@gmail.com> wrote:
> >> > You are confusing here two distinct roles of the parenthesis:
> >> > disambiguation
> >> > as in "(1 + 2) * 2", and tuple construction as in (1, 2, 3). This
> >> > overload
> >> > is the reason that (1) is not a 1-tuple and we must write (1,).
> >>
> >> Parentheses do not a tuple make. Commas do.
> >>
> >> 1, 2, 3, # three-element tuple
> >> 1, 2, # two-element tuple
> >> 1, # one-element tuple
> >>
> > And what [1, 2, 3] means? It's very different from [(1,2,3)].
> >
> > Python explicitly allow 1, 2, 3 to mean tuple in certain contexts, I
> agree.
> >
>
> Square brackets create a list. I'm not sure what you're not understanding,
> here.
>
> The comma does have other meanings in other contexts (list/dict/set
> display, function parameters), but outside of those, it means "create
> tuple".
>

On a second thought you may decide whether the rule is tuple and there are
exceptions, or the other way around.

The point was, conceptual expansion does not "fail" just because there is
an overloading in the meaning of the tokens ( and ). It might make it
harder to understand, though.

Elazar
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to