Message333409
When creating a class, I sometimes wish to get this behavior:
def MyClass:
def __init__(self, param):
self._param = param
def __repr__(self):
return f"MyClass(param={self._param})"
Unless I'm making a mistaking, this behavior is not currently possible with dataclasses.
I propose to change:
field(*, default=MISSING, default_factory=MISSING, repr=True, hash=None, init=True, compare=True, metadata=None)
to:
field(*, default=MISSING, default_factory=MISSING, repr=True, hash=None, init=True, compare=True, metadata=None, target=None)
with target being used as the init parameter name for this field and in the repr.
If this is accepted, I can post the patch to make this change. |
|
Date |
User |
Action |
Args |
2019-01-10 17:11:13 | remi.lapeyre | set | recipients:
+ remi.lapeyre |
2019-01-10 17:11:11 | remi.lapeyre | set | messageid: <1547140271.38.0.846532339527.issue35710@roundup.psfhosted.org> |
2019-01-10 17:11:11 | remi.lapeyre | link | issue35710 messages |
2019-01-10 17:11:11 | remi.lapeyre | create | |
|