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.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

enum-0.1-py2.3.egg (1.0 kB view details)

Uploaded Egg

File details

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

File metadata

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

File hashes

Hashes for enum-0.1.tar.gz
Algorithm Hash digest
SHA256 08089f638c278e8bd29bc68d87708da719bffd4bb176aa78b08b31dd029bf751
MD5 1b8a841365c3ec31c36310e60479fd73
BLAKE2b-256 bb650e9de2344b8285d62fe5853b159110cd349bc16333c5dfc0bc3c1dc047d5

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for enum-0.1-py2.3.egg
Algorithm Hash digest
SHA256 6b9e4713c7d76b6b8e5e2f58d1a143beb596e3e19af55748f128cfce5ff64572
MD5 fa18a55bab7f6ccbb640e93aee43a310
BLAKE2b-256 bbf6769447f35e92cb013e07b0f808d42068e8a98827c8a3faca38d44562c4b6

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