Feat: Base Class Implemenations
base implemenation of some classes following code_structures.md
Why are you using enumerations and not dictionaries
class PlayerClasses(Enum):
SCION = 0
MARAUDER = 1
RANGER = 2
WITCH = 3
DUELIST = 4
TEMPLAR = 5
SHADOW = 6
I setup the colorCodes as a dictionary
colorCodes = {
"NORMAL": "#000000",
"MAGIC": "#8888FF",
"RARE": "#FFFF77",
I'm not sure of the advantages of either.
X
PEP 345 lists some reasons for using enums. Further advantages:
- Enums have a distinct type
- Dicts are stringly typed, so enums avoid typos
- Enum variants are discoverable and you can auto-complete them
- Nicer syntax: dot access vs key access; allows for automatic enumeration.
- Stronger type guarantees for subtypes like
enum.IntEnum(comparable totyping.TypedDict, but without the need for annotations)
PEP 345 lists some reasons for using enums. Further advantages:
Currently I'm filling a combobox with
self.colour_combo_box.addItems(color_codes.keys())
Which is super convenient.

Whilst the color_codes naturally would be good as enums, what hoops to to go through to fill the combobox ? Or is there a different way to choose colours ?
x
You can iterate over an enum's variants and get their names:
self.colour_combo_box.addItems([colour.name for colour in ColourCodes])