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())

or:

class Color(BitMaskEnum):       # python 3+ only
    black
    red
    green
    blue

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

0.1

Download files

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

Source Distributions

yaenum-0.1.zip (12.6 kB view details)

Uploaded Source

yaenum-0.1.tar.gz (8.3 kB view details)

Uploaded Source

File details

Details for the file yaenum-0.1.zip.

File metadata

  • Download URL: yaenum-0.1.zip
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for yaenum-0.1.zip
Algorithm Hash digest
SHA256 b6fd7bcdaf52cb2e8f7958c72e24cea28cc202f4cfe5e5ee64d2020055131ee9
MD5 235f33d5e6f32f5b9e3f60ce2f9318fb
BLAKE2b-256 7ed2bdff4b33b47f225fd7f6ad8d5902a6fd9db57f1969b2cfd9d364d8b43d34

See more details on using hashes here.

File details

Details for the file yaenum-0.1.tar.gz.

File metadata

  • Download URL: yaenum-0.1.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for yaenum-0.1.tar.gz
Algorithm Hash digest
SHA256 ee17c20c43145a26a39fd55fbdfbe16d98649b977bd73ae652218ad5c920a6bb
MD5 5f54d162b5296cd086022e21eede38b9
BLAKE2b-256 774ab9d03edf9500c003ceeb1409cdaf4bd3e3fc47a68d08489c77a7cc97b03a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page