Hello there.
I am new in Python, so sorry for stupid question.

Here is my chunk of code.

class Map(object):

    scenes = [
    'central_corridor': CentralCorridor(),
    'laser_weapon_armory': LaserWeaponArmory(),
    'the_bridge': TheBridge(),
    'escape_pod': EscapePod(),
    'death': Death()
    ]

    def __init__(self, start_scene):
        self.start_scene = start_scene
    def next_scene(self, scene_name):
        return Map.scenes.get(scene_name)
    def opening_scene(self):
        return self.next_scene(self.start_scene)ap = Map('central_corridor') 

Interpreter shows me

  File "ex43.py", line 173
    'central_corridor': CentralCorridor(),
                      ^
SyntaxError: invalid syntax

What can cause it?

Recommended Answers

All 2 Replies

A dictionary is created with {} delimiters, not [].

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.