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 ethan.furman
Recipients craigh, ethan.furman
Date 2015-02-19.22:12:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1424383922.1.0.193945991188.issue23486@psf.upfronthosting.co.za>
In-reply-to
Content
Craig Holmquist wrote:
---------------------
> The consumer of that iteration processes each object with a switch-case-like
> comparison of the category, checking it sequentially against each instance
> of the Enum.

So for every object you compare against every Enum member?  Is there a reason you don't just use the lookup capability?

  class Category(Enum):
    tiny = 1
    medium = 2
    large = 3

  cat = Category(obj.category) # assumes obj.category is 1, 2, or 3
History
Date User Action Args
2015-02-19 22:12:02ethan.furmansetrecipients: + ethan.furman, craigh
2015-02-19 22:12:02ethan.furmansetmessageid: <1424383922.1.0.193945991188.issue23486@psf.upfronthosting.co.za>
2015-02-19 22:12:02ethan.furmanlinkissue23486 messages
2015-02-19 22:12:02ethan.furmancreate