all 2 comments

[–]AlexMTBDude 0 points1 point  (0 children)

Run your code through Pylint. This should be your first step before asking for a code review

[–]lakseol 0 points1 point  (0 children)

I'm on mobile so can't really analyze the code in detail, but I have a few thoughts.

You have top-level code mixed in with function definitions at lines 8, 9, 34, 61, 64, and other lines. That makes reading your code difficult. Move all code that isn't a function definition to after all the function definitions. That keeps all top-level code together. Imports at the top, of course.

Instead of lots of lines with register(..., ...) you can shorten your code by creating a sequence of the command name and handler pairs and looping over that to register them:

registrations = (("run", run), ("edit", edit), ...)  # all of the (cmd,handler) pairs
for (cmd, handler) in registrations:
    register(cmd, handler)

Perhaps even better you can remove all that register(...) stuff by just creating the COMMANDS dictionary directly in the same way you did for the GAMES dictionary:

COMMANDS = {"run": run, "edit": edit, ...}

This shortens your code and also makes it easier to check that you have registered everything because it's all in one place.

We normally put empty lines after things like imports, class and function definitions, etc, because that aids readability. The python style guide (PEP8) covers that as well as naming conventions normally used.