Prakhar Goel <newt0...@gmail.com> added the comment:

Hi,

As another piece of evidence: I run into this problem _all the time_. Whenever 
I need a field in the parent with a default, I either need to add bogus default 
values for every field in every subclass or just skip the default in the parent.

I'd like to suggest a middle ground:
1. A field level keyword_only option which forces just that field to be a 
kw-only field (for every subclass as well).
2. A class level keyword_only option that does:
2a. False (default) means current behavior where classes are not keyword only 
(but may be forced to be by the field specific arg).
2b. True means all the fields in this class (but not the subclasses!) Would be 
marked as keyword only. This does affect the order of arguments in the init 
method but that seems acceptable given that keyword only parameters are 
conceptually order independent.
2c. None implies that precisely the fields with a default (or default_factory) 
should be keyword only fields.

Thoughts?

----------
nosy: +Prakhar Goel

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33129>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to