You don't need to call __init__(...)
explicitly, when you create the object:
level = levelClass('Level 0')
it implicitly calls __init__(...)
with the argument "Level 0", so you don't need to do it in the while
loop.
The __init__
method is roughly what represents a constructor in Python, so it is supposed to be executed just one time, when you create the object.
Edit:
In conclusion, you must not call __init__()
, when you create the object:
level = levelClass('Level 0')
it is called implicitly, so to correct your problem, delete this line:
level.__init__()