[issue32513] dataclasses: make it easier to use user-supplied special methods
Eric V. Smith
report at bugs.python.org
Mon Jan 22 06:02:11 EST 2018
Eric V. Smith <eric at trueblade.com> added the comment:
The discussion on python-dev was that your ??? box would be "no": if the user supplied __repr__, they obviously meant for dataclass() to not provide one.
I can't see why the user would say repr=True ("I want dataclass() to add __repr__"), but then provide a __repr__ and get an exception. That looks like the only functionality added by your repr=True row over the proposal. Where your proposal uses repr=None for the "no", "yes" row, mine uses repr=True.
It's not like there's action at a distance here: the user is writing the class. Especially since base classes are ignored.
I'm ignoring make_dataclasses(), where the user is dynamically creating a class and maybe a __repr__ snuck in. But I don't care so much about that case.
I do think your ascii tables are a good way of explaining this. Thanks! (Now I need a 3D version for eq, frozen, hash!)
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32513>
_______________________________________
More information about the Python-bugs-list
mailing list