This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Prakhar Goel
Recipients Prakhar Goel, alan_du, eric.smith, jimbo1qaz_, rhettinger, wanderrful, xtreak
Date 2020-07-22.20:21:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1595449270.06.0.235058431338.issue33129@roundup.psfhosted.org>
In-reply-to
Content
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?
History
Date User Action Args
2020-07-22 20:21:10Prakhar Goelsetrecipients: + Prakhar Goel, rhettinger, eric.smith, alan_du, xtreak, jimbo1qaz_, wanderrful
2020-07-22 20:21:10Prakhar Goelsetmessageid: <1595449270.06.0.235058431338.issue33129@roundup.psfhosted.org>
2020-07-22 20:21:10Prakhar Goellinkissue33129 messages
2020-07-22 20:21:09Prakhar Goelcreate