New submission from Andre Roberge <[email protected]>:
The following code is currently consistent with the type hint syntax but
contains a line that is completely ignored.
>>> d = {}
>>> d['a']: int
>>> d
{}
>>> __annotations__
{}
>>> '__annotations__' in dir(d)
False
I believe that type hints that cannot be either attached to an object nor added
to any other __annotations__ dict should either generate a SyntaxError or, at
the very least, result in a warning.
----------
messages: 374884
nosy: aroberge
priority: normal
severity: normal
status: open
title: Unusable type hint should not be silently ignored
type: behavior
versions: Python 3.6, Python 3.7, Python 3.8, Python 3.9
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue41488>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com