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 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.tar.gz (5.3 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-py2.4.egg (5.0 kB view details)

Uploaded Egg

enum-0.3-py2.3.egg (5.0 kB view details)

Uploaded Egg

File details

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

File metadata

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

File hashes

Hashes for enum-0.3.tar.gz
Algorithm Hash digest
SHA256 5030e1725e8bec16450cd657aa508e430f2cd4dabb1ca57191ee0578d0f62e96
MD5 08ddf2bcd8ddb2e50d089d17ff0a18e4
BLAKE2b-256 53109798036cb407d1365a2bac6e5f3b516c14b9cedcad766aa7c4042212dbce

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for enum-0.3-py2.4.egg
Algorithm Hash digest
SHA256 ecbb27a2f177da05281357f75d7b4481fe5fa8322a4f2ea68148aee4c0ad80d6
MD5 cc3d63bc78eed7b5e2eaecda5121c21b
BLAKE2b-256 8860221cd716d01beca8c088aaeaccf12941822bd433d47e835528202b561a3a

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for enum-0.3-py2.3.egg
Algorithm Hash digest
SHA256 f9725552ede5bb9fd65733b3880e8743a515fb1faf9e73b56bec95fc66c8781f
MD5 4f811d9160184b04f5585528a3653fb1
BLAKE2b-256 1b730712496d000eba0f01ac7f6f5202b7d594d6b0dbca7c7d13be71dc1bacbd

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