Hello all,
I am trying to understand the code of ex43.
I have arrived to this part of the code:
class Map(object):
scenes = {
'central_corridor': CentralCorridor(),
'laser_weapon_armory': LaserWeaponArmory(),
'the_bridge': TheBridge(),
'escape_pod': EscapePod(),
'death': Death(),
'finished': Finished(),
}
def __init__(self, start_scene):
self.start_scene = start_scene
def next_scene(self, scene_name):
**val = Map.scenes.get(scene_name)** # Where is this get() method defined and can somebody explain what Map.scene.get(scene_name) does?
return val
def opening_scene(self):
return self.next_scene(self.start_scene)
Question: Where is this get() method defined and can somebody explain what Map.scene.get(scene_name) does? It feels like the object would have to refer to itself/message itself once more, and I do not understand why this is necessary. I have also inserted the comment next to the code.