[New-bugs-announce] [issue35814] Syntax quirk with variable annotations

Raymond Hettinger report at bugs.python.org
Thu Jan 24 00:45:39 EST 2019

New submission from Raymond Hettinger <raymond.hettinger at gmail.com>:

Am not sure how much we care about this, but parenthesis around tuples stops being optional when there is a variable annotation. 

>>> from typing import Tuple
>>> t = 10, 'hello'                     # Parens not normally required
>>> t: Tuple[int, str] = (10, 'hello')  # Annotated allows parens
>>> t: Tuple[int, str] = 10, 'hello'    # Annotated w/o parens fails
SyntaxError: invalid syntax

components: Interpreter Core
messages: 334280
nosy: rhettinger
priority: low
severity: normal
status: open
title: Syntax quirk with variable annotations
type: behavior
versions: Python 3.7

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list