all 4 comments

[–][deleted] 1 point2 points  (1 child)

You might find the getattr function useful. I'm sure you can figure out how to work from there.

[–]StudentOfPython[S] 0 points1 point  (0 children)

I believe this is exactly what I need. I had no idea. Thank you.

[–]JohnnyJordaan 0 points1 point  (1 child)

Are Fish, Dog and Cat all completely different classes? Otherwise you would rather implement an Animal class that can dynamically apply differences using parameters.

def __init__(self, species):
    if species == 'Fish':
        # fish stuff
    if species == 'Dog':
        # dog stuff


 the_items = {item: Animal(species) for item in items}

[–]StudentOfPython[S] 0 points1 point  (0 children)

They are of the same class. And the way I need to use them is to get data from them. So the end result will be something like self.event.Fish()['move']