[Python-Dev] Second post: PEP 557, Data Classes (original) (raw)

Sebastian Rittau srittau at rittau.biz
Mon Nov 27 07:26:48 EST 2017


On 27.11.2017 12:01, Sebastian Rittau wrote:

The major changes from the previous version are:

- Add InitVar to specify initialize-only fields. This is the only feature that does not sit right with me. It looks very obscure and "hacky". From what I understand, we are supposed to use the field syntax to define constructor arguments. I'd argue that the name "initialize-only fields" is a misnomer, which only hides the fact that this has nothing to do with fields at all. Couldn't dataclassses just pass *args and **kwargs to postinit()? Type checkers need to be special-cases for InitVar anyway, couldn't they instead be special cased to look at postinit argument types? I am sorry for the double post, but I thought a bit more about why this does not right with me:

I hope I did not misunderstood the purpose of InitVar.

 - Sebastian

-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20171127/1009adcc/attachment.html>



More information about the Python-Dev mailing list