hongweipeng <[email protected]> added the comment:
I think we can refer to typing.py, it does not have this issue.
>>> from typing import NamedTuple
>>> A = NamedTuple('A', [('name', str), ('id', int)])
>>> class B(NamedTuple):
... name: str
... id: int
...
>>> A.__module__
'__main__'
>>> B.__module__
'__main__'
It uses `nm_tpl.__module__ = sys._getframe(2).f_globals.get('__name__',
'__main__')`.
----------
nosy: +hongweipeng
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue28869>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com