Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

Python 3.4 Enum backported to 3.3, 3.2, 3.1, 2.7, 2.6, 2.5, and 2.4

Project description

An enumeration is a set of symbolic names (members) bound to unique, constant values. Within an enumeration, the members can be compared by identity, and the enumeration itself can be iterated over.

from enum import Enum

class Fruit(Enum):
apple = 1 banana = 2 orange = 3

list(Fruit) # [< 1>, <Fruit.banana: 2>, < 3>]

len(Fruit) # 3

Fruit.banana # <Fruit.banana: 2>

Fruit[‘banana’] # <Fruit.banana: 2>

Fruit(2) # <Fruit.banana: 2>

Fruit.banana is Fruit[‘banana’] is Fruit(2) # True # ‘banana’

Fruit.banana.value # 2

Repository and Issue Tracker at

Project details

Download files

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

Files for enum34, version 1.1.10
Filename, size File type Python version Upload date Hashes
Filename, size enum34-1.1.10-py2-none-any.whl (11.2 kB) File type Wheel Python version py2 Upload date Hashes View
Filename, size enum34-1.1.10-py3-none-any.whl (11.2 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size enum34-1.1.10.tar.gz (28.2 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page