Skip to content

Commit

Permalink
fix printing of enum value (needed for Python 3.11 and 3.12)
Browse files Browse the repository at this point in the history
  • Loading branch information
svlandeg committed Sep 12, 2024
1 parent e13a083 commit adb7c03
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ def main(
),
):
for name in names:
print(f"Hello {name}")
if isinstance(name, Enum):
print(f"Hello {name.value}")
else:
print(f"Hello {name}")


if __name__ == "__main__":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ def main(
] = ("Harry", "Hermione", "Ron", "hero3"),
):
for name in names:
print(f"Hello {name}")
if isinstance(name, Enum):
print(f"Hello {name.value}")
else:
print(f"Hello {name}")


if __name__ == "__main__":
Expand Down

0 comments on commit adb7c03

Please sign in to comment.