This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author kissgyorgy
Recipients barry, eli.bendersky, ethan.furman, kissgyorgy
Date 2014-09-06.00:43:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1409964215.19.0.955372110416.issue22339@psf.upfronthosting.co.za>
In-reply-to
Content
> Is this a way to easily handle multiple aliases?

You mean this MultiValueEnum implementation? (If not I don't understand the question, could you elaborate?)

No, this is the opposite of aliases, because an alias is when the same value have multiple names, but this is when the values are used to lookup the same name.

I use it when very similar values have the same meaning like:

    class Suit(MultiValueEnum):
        CLUBS =    '♣', 'c', 'C', 'clubs', 'club'
        DIAMONDS = '♦', 'd', 'D', 'diamonds', 'diamond'
        HEARTS =   '♥', 'h', 'H', 'hearts', 'heart'
        SPADES =   '♠', 's', 'S', 'spades', 'spade'


Also it can be used for ECP testing (Equivalence class testing) like this:

    from http.client import responses
    class ResponseEnum(MultiValueEnum):
        GOOD = [status for status in responses if 200 <= status <= 299]
        BAD = [status for status in responses if not (200 <= status <= 299)]

I did not think about this use case, but I think it's very interesting and useful.
History
Date User Action Args
2014-09-06 00:43:35kissgyorgysetrecipients: + kissgyorgy, barry, eli.bendersky, ethan.furman
2014-09-06 00:43:35kissgyorgysetmessageid: <1409964215.19.0.955372110416.issue22339@psf.upfronthosting.co.za>
2014-09-06 00:43:35kissgyorgylinkissue22339 messages
2014-09-06 00:43:33kissgyorgycreate