[issue45972] typing.NamedTuple with default arguments without type annotations is falsy
Alex Waygood
report at bugs.python.org
Fri Dec 3 04:33:21 EST 2021
Alex Waygood <Alex.Waygood at Gmail.com> added the comment:
I agree that prohibiting zero-length NamedTuples seems like a bad idea, and also agree that this probably doesn't need to be documented.
The behaviour here definitely looks weird at first glance, but it's probably not a good idea to tamper with the __bool__() methods of NamedTuple classes either: an empty NamedTuple probably *should* be falsey by default, even if it has a class attribute.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45972>
_______________________________________
More information about the Python-bugs-list
mailing list