Skip to main content

Enum module supporting sequence, bitmask, and string enumerations

Project description

Yet Another Enumerator is an enum module that supports three different types of enumerations:

  • sequence enums (0, 1, 2, 3, etc.)
  • base 2 bitmask enums (0, 1, 2, 4, 8, etc.)
  • string enums (‘top’,’bottom’,’left’,’right’, etc.)

Each Enumeration is its own class, with instances of that class being singletons. Besides being a value, enum instances can also have their own behavior (use case, anyone?).

Creating an enum is as simple as:

from yaenum import Enum, BitMaskEnum, UniqueEnum, enum

Enum.create('Color', 'red green blue', export=globals())


class Color(BitMaskEnum):       # python 3+ only

and if that’s too magical for you:

class Color(BitMaskEnum):
    black = enum()              # python 2: enum(value=0) etc.
    red   = enum()
    green = enum()
    blue  = enum()

Project details

Release history Release notifications | RSS feed

This version


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for yaenum, version 0.1
Filename, size File type Python version Upload date Hashes
Filename, size yaenum-0.1.tar.gz (8.3 kB) File type Source Python version None Upload date Hashes View
Filename, size (12.6 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page