Message 406605 - Python tracker

Message406605

Author rhettinger
Recipients AlexWaygood, andrei.avk, berker.peksag, corona10, grahamd, lukasz.langa, pablogsal, randolf.scholz, rhettinger, serhiy.storchaka, terry.reedy, wim.glenn
Date 2021-11-19.18:12:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1637345547.62.0.764840774154.issue45356@roundup.psfhosted.org>
In-reply-to
Content
I propose deprecating classmethod chaining.  It has become clear that it doesn't really do what people wanted and can't easily be made to work.

By even suggesting that some stateful decorators are composable, we've ventured onto thin ice.  Wrapping property in a classmethod doesn't produce something that behaves like a real property.  Mixing staticmethod and property doesn't work at all.  Putting abstractmethod in the mix doesn't work well either.  The ecosystem of code inspection tools, like help() in this issue, is wholly unprepared for recognizing and working around these combinations.  The latest "fix" for classmethod chaining looks weird and worriesome as well:  self.f.__get__(cls, cls).

Classmethod chaining is relatively new, so we will affect very little code by deprecating it.  Any of the possible use cases can be served in other ways like the wrapt package or by explicit code in __getattribute__.
History
Date User Action Args
2021-11-19 18:12:27rhettingersetrecipients: + rhettinger, terry.reedy, grahamd, lukasz.langa, berker.peksag, serhiy.storchaka, wim.glenn, corona10, pablogsal, andrei.avk, randolf.scholz, AlexWaygood
2021-11-19 18:12:27rhettingersetmessageid: <1637345547.62.0.764840774154.issue45356@roundup.psfhosted.org>
2021-11-19 18:12:27rhettingerlinkissue45356 messages
2021-11-19 18:12:27rhettingercreate