You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Various things in stdlib could benefit from the plugin system #3541
I would rather try supporting this by adding a protocol like Addable, (maybe also Comparable for sorted in Python 3). If that will not work, then this can be done using a plugin, but Addable and Comparable may be useful on their own.
Addable and Comparable may be hard to support in full generality. The complex semantics of reverse operator methods such as __add__ vs. __radd__ are one factor. When I looked at this earlier I came up with some tricky-looking corner cases but I can't remember all the details any more.
It's not a priority to get rid of the existing special casing for enum, but it would be better to use the plugin system for new features whenever possible. In the long term it may make sense to use a plugin for all or most of enum functionality.
Activity
ilevkivskyi commentedon Jun 14, 2017
I would rather try supporting this by adding a protocol like
Addable, (maybe alsoComparableforsortedin Python 3). If that will not work, then this can be done using a plugin, butAddableandComparablemay be useful on their own.JukkaL commentedon Jun 14, 2017
AddableandComparablemay be hard to support in full generality. The complex semantics of reverse operator methods such as__add__vs.__radd__are one factor. When I looked at this earlier I came up with some tricky-looking corner cases but I can't remember all the details any more.ilevkivskyi commentedon Jun 15, 2017
I would add better support for
enumto the list, see for example #3546Or are we going to continue special casing
Enumdirectly in code?JukkaL commentedon Jun 15, 2017
It's not a priority to get rid of the existing special casing for
enum, but it would be better to use the plugin system for new features whenever possible. In the long term it may make sense to use a plugin for all or most ofenumfunctionality.ilevkivskyi commentedon Aug 29, 2017
Here is an example where plugin for
itertools.productwill be useful: #3884hauntsaninja commentedon Oct 31, 2021
Closing because stale / protocols and literals. #7803 would be useful though!