I’m traveling until next week, and haven’t had time to read any of these emails. I’ll look at them when I return. -- Eric. > On Dec 30, 2017, at 5:20 AM, Raymond Hettinger <raymond.hettinger at gmail.com> wrote: > > >> On Dec 29, 2017, at 4:52 PM, Guido van Rossum <guido at python.org> wrote: >> >> I still think it should overrides anything that's just inherited but nothing that's defined in the class being decorated. > > This has the virtue of being easy to explain, and it will help with debugging by honoring the code proximate to the decorator :-) > > For what it is worth, the functools.total_ordering class decorator does something similar -- though not exactly the same. A root comparison method is considered user-specified if it is different than the default method provided by object: > > def total_ordering(cls): > """Class decorator that fills in missing ordering methods""" > # Find user-defined comparisons (not those inherited from object). > roots = {op for op in _convert if getattr(cls, op, None) is not getattr(object, op, None)} > ... > > The @dataclass decorator has a much broader mandate and we have almost no experience with it, so it is hard to know what legitimate use cases will arise. > > > Raymond > > _______________________________________________ > Python-Dev mailing list > Python-Dev at python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: https://mail.python.org/mailman/options/python-dev/eric%2Ba-python-dev%40trueblade.com
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4