Skip to main content

Robust enumerated data types in Python

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

This package provides a robust enumerated data type for Python.

An enumeration object is created with a sequence of string arguments to the Enum() function:

>>> from enum import Enum
>>> Colour = Enum('red', 'blue', 'green')
>>> Weekday = Enum('mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun')

The return value is a new object with attributes for each of the string arguments; these attributes act as unique values within the enumeration:

>>> pixel_colour = Colour.blue

Enumeration objects are immutable, and can iterate their values. The values are constants that can be compared only with other values from the same enumeration, but can be coerced to simple strings matching the original arguments to Enum().

The design is based in part on Zoran Isailovski’s recipe, “First Class Enums in Python” in the ASPN Python Cookbook <URL:http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/413486>.

Project details


Download files

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

Source Distribution

enum-0.1.1.tar.gz (4.9 kB view details)

Uploaded Source

Built Distributions

enum-0.1.1-py2.4.egg (4.5 kB view details)

Uploaded Egg

enum-0.1.1-py2.3.egg (4.5 kB view details)

Uploaded Egg

File details

Details for the file enum-0.1.1.tar.gz.

File metadata

  • Download URL: enum-0.1.1.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for enum-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e6469b807ba4ba68d1823cc85faa5703cea0ffb18220ff5df7e4f4395b3a6a29
MD5 c79e2cc81a582760f7ac93a314e6bb94
BLAKE2b-256 5ce2630fc2ce1ce462260aaf5c6e3da496c00c2585bf57bf3852f753a9821ee7

See more details on using hashes here.

File details

Details for the file enum-0.1.1-py2.4.egg.

File metadata

  • Download URL: enum-0.1.1-py2.4.egg
  • Upload date:
  • Size: 4.5 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for enum-0.1.1-py2.4.egg
Algorithm Hash digest
SHA256 078b71339466fbcf0f412452440aa4a63956ef471aec23377e8df624659176dc
MD5 2d974193c62c466c589ff402f4289fae
BLAKE2b-256 1151da4ffb0bf0f08060ac91641fb8f18d5dc1376b72034a07f1b9abf4b33fb4

See more details on using hashes here.

File details

Details for the file enum-0.1.1-py2.3.egg.

File metadata

  • Download URL: enum-0.1.1-py2.3.egg
  • Upload date:
  • Size: 4.5 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for enum-0.1.1-py2.3.egg
Algorithm Hash digest
SHA256 3aa9cb3a6e3c5608c92b4ef6132d72dff32bcee3fd75027276125c6eb2ae330d
MD5 8073b855f75e50f55460be1f545420ad
BLAKE2b-256 3b320a2084bed5a5001655af751e28a419797ebcf8e4e95481659ff7ccb6a040

See more details on using hashes here.

Supported by

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