Just another update
This commit is contained in:
parent
a25938f123
commit
00a190b0a6
6591 changed files with 94363 additions and 23227 deletions
|
|
@ -1 +1,15 @@
|
|||
FIRST_NAME, LAST_NAME, PHONE = range(3)
|
||||
>>> 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 +1 @@
|
|||
vars().update((key,val) for val,key in enumerate(("FIRST_NAME","LAST_NAME","PHONE")))
|
||||
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