Skip to main content

Robust enumerated type support 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 class for robust enumerations in 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 an immutable sequence object with a value for each of the string arguments. Each value is also available as an attribute named from the corresponding string argument:

>>> pizza_night = Weekdays[4]
>>> pixel_colour = Colours.blue

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.3.1.tar.gz (19.5 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.3.1-py2.4.egg (1.2 kB view details)

Uploaded Egg

enum-0.3.1-py2.3.egg (1.2 kB view details)

Uploaded Egg

File details

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

File metadata

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

File hashes

Hashes for enum-0.3.1.tar.gz
Algorithm Hash digest
SHA256 df02acb036cf12320ae3d8ead195f0ce64449ee5fcab85c314a8634cac573969
MD5 441776985fb0c0d9e7aac6138ef9c651
BLAKE2b-256 0840cc51c52ade9e5f191342ab0e825d768dc7ea81bbf90ffbcf3571335133e4

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for enum-0.3.1-py2.4.egg
Algorithm Hash digest
SHA256 84e409c898dec1197b10e4481ac723c4712ed1dade11036d222b405a4c0f64f1
MD5 e1d4926d8ce8a370d09918c573379ab1
BLAKE2b-256 089bd5fe0e01fc91ba9f4a2aae7487df2185413bb0ab761112b623ac7964649e

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for enum-0.3.1-py2.3.egg
Algorithm Hash digest
SHA256 4b3b4f7bf303ead06ddb8891b3acca6d19e82526317049b7b5cfd21ac54330e2
MD5 4b667ec4b2abffe3bd1273c73701e709
BLAKE2b-256 f28689268fac79042571d294ea6078cc40f18c3d2864144cfd4725d68c880c63

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