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
>>> Colours = Enum('red', 'blue', 'green')
>>> Weekdays = 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 = Colours.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.2.tar.gz (4.9 kB view details)

Uploaded Source

Built Distributions

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

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

Uploaded Egg

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

Uploaded Egg

File details

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

File metadata

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

File hashes

Hashes for enum-0.2.tar.gz
Algorithm Hash digest
SHA256 cbb768b8af610491af1e2bcd261298dc32c70aa8ab7ab7506cd21b0f187fb882
MD5 da11461a78087685b04681a2a6684dbd
BLAKE2b-256 38448fa67f83724931ca76906b3db62df82cd1afcf9a873a85619da4ac2c96f7

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for enum-0.2-py2.4.egg
Algorithm Hash digest
SHA256 7118129c7f93cbcaf5e0d82770c26d31f5831ce77a3588ecf54f2044ac3fc62a
MD5 f08ee1e67e5614ece2f945f09389b260
BLAKE2b-256 788ceadffc9edbe05c4d2a96cb88f23ca719ca69e9daa8c4c86faf0bf3a4f3ef

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for enum-0.2-py2.3.egg
Algorithm Hash digest
SHA256 07b7cd897f853f4c80c7371f9fbab5637ad3ec1e985b74df3e774bb6f28ba475
MD5 0fd031e8df028e4e4b464f79628fc679
BLAKE2b-256 43296d8e645b6433bd1970c9ef1fbdffce058f4b8f027696ad6021c0ff10a294

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