Skip to main content

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) # [<Fruit.apple: 1>, <Fruit.banana: 2>, <Fruit.orange: 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

Fruit.banana.name # ‘banana’

Fruit.banana.value # 2

Repository and Issue Tracker at https://bitbucket.org/stoneleaf/enum34.

Project details


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
enum34-1.1.6-py2-none-any.whl (12.4 kB) Copy SHA256 hash SHA256 Wheel py2
enum34-1.1.6-py3-none-any.whl (12.4 kB) Copy SHA256 hash SHA256 Wheel py3
enum34-1.1.6.tar.gz (40.0 kB) Copy SHA256 hash SHA256 Source None
enum34-1.1.6.zip (44.8 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page