3 ms·
Yes, I do use python for scientific applications and enums are one of the things I miss - I've built around it in python 2.x by using this construct: def e
by m_mueller 12y ago
Yes, I do use python for scientific applications and enums are one of the things I miss - I've built around it in python 2.x by using this construct:
def enum(*sequential, **named):
enums = dict(zip(sequential, range(len(sequential))), **named)
return type('Enum', (), enums)
Init = enum("NOTHING_LOADED",
"DEPENDANT_ENTRYNODE_ATTRIBUTES_LOADED",
"ROUTINENODE_ATTRIBUTES_LOADED",
"DECLARATION_LOADED"
)
myState = Init.NOTHING_LOADED
3.x is still a non starter for me since many clusters where I want my software to work still only come with 2.6, e.g. I can't even use dictionary comprehensions. Adoption for scientific software is heavily influenced by how many external dependencies you have - requiring users without root access to compile python 3.x for their cluster home is a no-go.
- ubernostrum 12y agoNo offense meant, but if you're at a stage where you use a pre-2.7 version because that's what comes with the OS, then it's not really a case of "looked at 3.x and decided it didn't have anything". OS vendors who will be supporting ancient Python versions until the next decade are a blight on the entire ecosystem.
- m_mueller 12y ago> it's not really a case of "looked at 3.x and decided it didn't have anything" I agree, this isn't the main reason why I'm not looking at 3.x.