Posted on 28th January 2023
Here is one of the way to represent an Enum in Python:
def __getattr__(self, name):
if name in self:
return name raise AttributeError
Animals = Enum(["elephant", "dog", "rat"])
STILL GOT QUERIES?
Copyright © 2013 - 2023 MindMajix Technologies