-
Notifications
You must be signed in to change notification settings - Fork 15
Closed
Description
this will be a life changing improvement that must get top priority.
example:
from typing import NamedTuple
class DeviceTypes(NamedTuple):
CPU: str = 'cpu'
GPU: str = 'gpu'
DEVICE_TYPES = DeviceTypes()
print(DEVICE_TYPES.GPU) # 'gpu'advantages:
- really constant, you cannot change the value directly
- you only have to import DEVICE_TYPES, not CPU or GPU
- strings 'CPU' and 'GPU' don't have to be defined anymore
- thus, you cannot mistakenly use the 'CPU' or 'GPU' strings anymore
- easier syntax
DEVICE_TYPES.CPUinstead ofDEVICE_TYPES[CPU]: saves a full character!
for SCALES this is probably not a good idea, as we really want to use the strings themselves, e.g. on the cmd line.
Metadata
Metadata
Assignees
Labels
No labels