Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
15
Task/Enumerations/Python/enumerations-1.py
Normal file
15
Task/Enumerations/Python/enumerations-1.py
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
>>> from enum import Enum
|
||||
>>> Contact = Enum('Contact', 'FIRST_NAME, LAST_NAME, PHONE')
|
||||
>>> Contact.__members__
|
||||
mappingproxy(OrderedDict([('FIRST_NAME', <Contact.FIRST_NAME: 1>), ('LAST_NAME', <Contact.LAST_NAME: 2>), ('PHONE', <Contact.PHONE: 3>)]))
|
||||
>>>
|
||||
>>> # Explicit
|
||||
>>> class Contact2(Enum):
|
||||
FIRST_NAME = 1
|
||||
LAST_NAME = 2
|
||||
PHONE = 3
|
||||
|
||||
|
||||
>>> Contact2.__members__
|
||||
mappingproxy(OrderedDict([('FIRST_NAME', <Contact2.FIRST_NAME: 1>), ('LAST_NAME', <Contact2.LAST_NAME: 2>), ('PHONE', <Contact2.PHONE: 3>)]))
|
||||
>>>
|
||||
1
Task/Enumerations/Python/enumerations-2.py
Normal file
1
Task/Enumerations/Python/enumerations-2.py
Normal file
|
|
@ -0,0 +1 @@
|
|||
FIRST_NAME, LAST_NAME, PHONE = range(3)
|
||||
1
Task/Enumerations/Python/enumerations-3.py
Normal file
1
Task/Enumerations/Python/enumerations-3.py
Normal file
|
|
@ -0,0 +1 @@
|
|||
vars().update((key,val) for val,key in enumerate(("FIRST_NAME","LAST_NAME","PHONE")))
|
||||
Loading…
Add table
Add a link
Reference in a new issue