08.10.21 22:23, Jeremiah Paige пише: >>>> Point = namedtuple(<<<, 'x, y, z') >>>> Point > <class '__main__.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. _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/UIOYDLSDH6TP4DY5C36HTFAJDNTENJ47/ Code of Conduct: http://python.org/psf/codeofconduct/