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 <rep...@bugs.python.org>
<http://bugs.python.org/issue26266>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to