Hacker News new | past | comments | ask | show | jobs | submit login

Since Enums are mostly unmagical (apart from the member wrapping), you can use a compact syntax:

  class Colors(Enum):
      red, green, blue = range(3)



will

    red, green, blue = itertools.count()
work too?


If it works in a Python shell, it will work for an enum (this doesn't).




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: