[issue45972] typing.NamedTuple with default arguments without type annotations is falsy
Spencer Brown
report at bugs.python.org
Fri Dec 3 03:58:36 EST 2021
Spencer Brown <spencerb21 at live.com> added the comment:
What's happening is that typing.NamedTuple ignores non-annotated attributes entirely when computing the names it passes along to namedtuple(), so here "a" is just a class attribute. You're accessing it from there, but the tuple itself is entirely empty. Perhaps it should error out if no names at all are found?
----------
nosy: +Spencer Brown
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45972>
_______________________________________
More information about the Python-bugs-list
mailing list