On Apr 29, 2013, at 03:36 PM, Steven D'Aprano wrote: >That's not how I understand it. I expected that the correct way to use >enums is with identity checks: > >if arg is Season.SUMMER: > handle_summer()
It's certainly the way I've recommended to use them. I think `is` reads better in context, and identity checks are usually preferred for singletons, which enum items are. You can use equality checks, but think about this: if thing == None: vs. if thing is None: -Barry _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com