[issue26266] add classattribute to enum to handle non-Enum attributes
Ethan Furman
report at bugs.python.org
Thu Jun 2 19:20:19 EDT 2016
Ethan Furman added the comment:
One possible downside to the `classattribute` route is that we have a descriptor whose only purpose is to shield the item from becoming a member; the up-side is that it's simple to implement.
Another possibility is `skip`:
class skip:
"""
Protects item from becaming an Enum member during class creation.
"""
def __init__(self, value):
self.value = value
def __get__(self, instance, ownerclass=None):
return self.value
The advantage is that it is replaced by the metaclass with the stored value, so we have no extraneous descriptor after the Enum is created; the downside is that it requires change in the metaclass to do the right thing.
Thoughts?
----------
stage: -> needs patch
type: behavior -> enhancement
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26266>
_______________________________________
More information about the Python-bugs-list
mailing list