A suggestion for ease of extension in the future: replace `field` parameter 
`kw_only` with `init_type`.

As `field` is expected to be used less than `_: dataclasses.KW_ONLY` and 
`dataclass(kw_only=True)`, it can afford to be more verbose. On top of that, if 
you want to add positional-only fields in the future, with your current 
proposal for keyword-only fields would mean you'd have to add another parameter 
to `field` (eg `pos_only`).

My suggestion is to instead make the parameter to `field` become `init_type`, 
which accepts an `enum` member (called `FieldInitParamType`, with members 
`normal` (or `positional_or_keyword`) and `keyword_only` (and in the future, 
`positional_only`)). This makes the parameter specifically about the type of 
the parameter for the data-class's `__init__`, and allows for any number of 
parameter types in the future without having to add new parameters to `field`.

Laurie
_______________________________________________
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/PX5ZPZPEJA3UAWY7ZGOCMECY5MA3CKEW/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to