Ethan Furman added the comment:
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
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue23486>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com