A little background – I am playing around with pygame, and want to create a dictionary of all Mob class instances’ positions.
The way I see it:
human = Mob(pos)
mob_positions = {human : pos}
So every time I call Mob.__init__() I wanted to add a pos to mob_positions dict.
How do I access current instance variable name? Or is it extremely wrong approach?
The current instance variable is simply the first argument to the function. By convention it is named
self.Here’s how I’d do things.