Add a paragraph describing another rational for using InitVar pseudo-fields.

This commit is contained in:
Eric V. Smith 2017-12-08 03:05:16 -05:00
parent 4b33897304
commit b46be0d897
1 changed files with 8 additions and 0 deletions

View File

@ -756,6 +756,14 @@ through ``__init__`` (unless you suppress its creation). Which
approach is more appropriate will be application-specific, but both
approaches are supported.
Another reason for using ``InitVar`` fields is that the class author
can control the order of ``__init__`` parameters. This is especially
important with regular fields and ``InitVar`` fields that have default
values, as all fields with defaults must come after all fields without
defaults. A previous design had all init-only fields coming after
regular fields. This meant that if any field had a default value,
then all init-only fields would have to have defaults values, too.
asdict and astuple function names
---------------------------------