10 Aug
2021
10 Aug
'21
6:13 p.m.
Damian Shaw wrote: > > dataclasses need to check for ClassVar > > Interesting, so the use case we are talking about is: 1) You are using > annotations to mean actual types, 2) But you also have to inspect them at > runtime, 3) For some of the types the name might not be defined at runtime > yet > In this example doesn't the current behavior, PEP 649, and PEP 563 (using > get_type_hints) all throw an exception? > Could PEP 649 be modified to say that if a NameError is raised the result > is not cached and therefore you can inspect it later at runtime to get the > real type once it is defined? Wouldn't that then allow users to write code > that allows for all use cases under this scenario? > - Damian (he/him) > On Tue, Aug 10, 2021 at 1:55 PM Thomas Grainger tagrain@gmail.com wrote: > > dataclasses need to check for ClassVar > > _______________________________________________ > > Python-Dev mailing list -- python-dev@python.org > > To unsubscribe send an email to python-dev-leave@python.org > > https://mail.python.org/mailman3/lists/python-dev.python.org/ > > Message archived at > > https://mail.python.org/archives/list/python-dev@python.org/message/WOTCUBAO... > > Code of Conduct: http://python.org/psf/codeofconduct/ > > Yep it would need a note on the pep. It's a narrow usecase and everyone who does use the feature (attrs, pydantic etc) are watching this PEP carefully so it shouldn't be too much of a comparability concern