[docs] [issue33459] Define "tuple display" in the docs

Andrés Delfino report at bugs.python.org
Fri May 11 13:56:15 EDT 2018

Andrés Delfino <adelfino at gmail.com> added the comment:

The thing is that "tuple displays" like:

nums = (n for n in range(10))

Yield a generator expression instead of a tuple.

Also, unparenthesized "tuple displays" like 1, 2, 3 can't be used in expressions, AFAIK:

>>> if 3 == 1, 2, 3:
SyntaxError: invalid syntax

So, you end up using parenthesized expressions (that may or may not shield tuples) to use tuples in expressions. So talking about "tuple expressions" in the operator precedence table doesn't make much sense to me :/

Also, if a "tuple display" doesn't yield a tuple, should it be named a "tuple display" after all?


Python tracker <report at bugs.python.org>

More information about the docs mailing list