Author ethan.furman
Recipients barry, eli.bendersky, ethan.furman
Date 2016-06-02.23:20:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1464909619.0.0.721902519481.issue26266@psf.upfronthosting.co.za>
In-reply-to
Content
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?
History
Date User Action Args
2016-06-02 23:20:19ethan.furmansetrecipients: + ethan.furman, barry, eli.bendersky
2016-06-02 23:20:19ethan.furmansetmessageid: <1464909619.0.0.721902519481.issue26266@psf.upfronthosting.co.za>
2016-06-02 23:20:18ethan.furmanlinkissue26266 messages
2016-06-02 23:20:18ethan.furmancreate