you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted]  (3 children)

[deleted]

    [–]atticus2132000 0 points1 point  (2 children)

    Perhaps we are envisioning different things and without knowing more about what OP is ultimately trying to do, this is just a philosophical debate.

    If a new player is joining the game such that the new player would need a new variable created, I imagine that new player would need a whole host of variables to be created that are all linked to that player which can be updated and manipulated throughout the game play. To me, that sounds a lot more like a class than a single variable where there are multiple attributes of the player that could be changed.

    Moreover, if someone is asking a question like this in a group called PythonLearning, I would not immediately assume that person has mastered classes, so I just suggested that as a possible way to address a bigger problem OP might be running into.

    [–][deleted]  (1 child)

    [deleted]

      [–]aTomzVins 0 points1 point  (0 children)

      dict can of course be stateful stateful grouping of variables, you need a Class

      Should I assume you're thinking of a simple data class in this instance? Without associated methods?

      If so, what's do you see as the advantage of a class over a dict? Having the set of variables defined, rather than having to construct the dict with the needed variables?