17 Oct
2021
17 Oct
'21
7:46 a.m.
08.10.21 22:23, Jeremiah Paige пише:
Point = namedtuple(<<<, 'x, y, z') Point
UUIDType = NewType(<<<, str) UUIDType __main__.UUIDType
In many cases similar to namedtuple and NewType this is not enough. You need to pass to the constructor not only name, but module name and full qualified name. The full qualified name is needed to make nested declarations working. And to getting the module name we currently need to use _getframe() which is ugly and non-portable. It may be useful to provide access also to globals and locals of the outer scope.