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.
Download filesDownload the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution Built Distributions File detailsDetails for the file enum34-1.1.10.tar.gz
.
cce6a7477ed816bd2542d03d53db9f0db935dd013b70f336a95c73979289f248
MD5 b5ac0bb5ea9e830029599e410d09d3b5
BLAKE2b-256 11c42da1f4952ba476677a42f25cd32ab8aaf0e1c0d0e00b89822b835c7e654c
See more details on using hashes here.
File detailsDetails for the file enum34-1.1.10-py3-none-any.whl
.
c3858660960c984d6ab0ebad691265180da2b43f07e061c0f8dca9ef3cffd328
MD5 c2bab643d4e8fd032973b312037a9164
BLAKE2b-256 63f6ccb1c83687756aeabbf3ca0f213508fcfb03883ff200d201b3a4c60cedcc
See more details on using hashes here.
File detailsDetails for the file enum34-1.1.10-py2-none-any.whl
.
a98a201d6de3f2ab3db284e70a33b0f896fbf35f8086594e8c9e74b909058d53
MD5 85f9f5509176e863bb723e10f44cd317
BLAKE2b-256 6f2ca9386903ece2ea85e9807e0e062174dc26fdce8b05f216d00491be29fad5
See more details on using hashes here.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4