[Python-Dev] Second post: PEP 557, Data Classes

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


On 27.11.2017 13:23, Eric V. Smith wrote:
> I had something like your suggestion half coded up, except I inspected 
> the args to __post_init__() and added them to __init__, avoiding the 
> API-unfriendly *args and **kwargs.
I understand your concerns with *args and **kwargs. I think we need to 
find a solution for that eventually.

> One other thing about InitVar: it lets you control where the init-only 
> parameter goes in the __init__ call. This is especially important with 
> default values:

This is indeed a nice property. I was thinking about that myself and how 
to best handle it. One use case that could occur in out codebase is 
passing in a "context" argument. By convention, this is always the first 
argument to the constructor, so it would be nice if this would also work 
for dataclasses.

  - Sebastian



More information about the Python-Dev mailing list