Message374108
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? |
|
Date |
User |
Action |
Args |
2020-07-22 20:21:10 | Prakhar Goel | set | recipients:
+ Prakhar Goel, rhettinger, eric.smith, alan_du, xtreak, jimbo1qaz_, wanderrful |
2020-07-22 20:21:10 | Prakhar Goel | set | messageid: <1595449270.06.0.235058431338.issue33129@roundup.psfhosted.org> |
2020-07-22 20:21:10 | Prakhar Goel | link | issue33129 messages |
2020-07-22 20:21:09 | Prakhar Goel | create | |
|