Python – What Is Enum Class ?
Table Of Content:
- What Is Enum ?
- Why Do We Use Enum ?
- Example Of Enum Class ?
- What Does StrEnum Means ?
- Where Do Enums Shine ?
- Benefits Of Enum ?
- Summary.
(1) What Is Enum ?

(2) Why Do We Use Enum ?

(4) Example Of Enum.


(5) What Is StrEnum ?

Example-1: Without StrEnum
from enum import Enum
class LLMType(Enum):
CHAT = "chat"
EMBEDDING = "embedding"
SPEECH2TEXT = "speech2text"
task_type = LLMType.SPEECH2TEXT
print(task_type)
LLMType.SPEECH2TEXT
Example-2: With StrEnum
from enum import StrEnum
class LLMType(StrEnum):
CHAT = "chat"
EMBEDDING = "embedding"
SPEECH2TEXT = "speech2text"
task_type = LLMType.SPEECH2TEXT
print(task_type)
speech2text
(6) Where Does Enum Shines

(7) Benefits Of Enum
