[issue35710] Make dataclasses.field() accept another name for __init__ field's name

Raymond Hettinger report at bugs.python.org
Mon Jan 14 01:25:48 EST 2019


Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:

"target" seems too general for the OP's use case.  "private=False" would be more focused.  General renaming occasionally has uses but is mostly an anti-pattern.  

Some thought also needs to be given to downstream effects of renaming (what shows up in help(), impact of renaming on type annotations, introspection challenges, what asdict() should do, whether the overall implementation would be made more complex, is the attribute now out of reach for __post_init__(), is this even within the scope of what dataclasses set out to do, etc).

----------
nosy: +rhettinger

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35710>
_______________________________________


More information about the Python-bugs-list mailing list