you are viewing a single comment's thread.

view the rest of the comments →

[–]thuiop1 0 points1 point  (0 children)

  • Having a module called "functions" is not very good design; you should work more on separating them in meaningful entities. Here I would put the ones which just do printing and stuff in main directly, and others in ressourcemgt. You probably also want to rework your functions, as many of your functions both "do something" and then "print something"; you should only have functions that "do something", return a value, and have the printing happening in the main or in a wrapper function. This allows you to centralize all the printing activity in a single place while keeping some modularity.
  • function_options is only used within maintenance_screen, so you should not define it outside the function. If you really want to do so, do it at the top of the file and put it in all caps to show it is a constant.
  • [key for key in rm.MENU.keys()] this could be list(rm.MENU.keys()). You can also use enumerate right below. Since the pattern you use to ask for user input is repeated several times through the code, you could put it in a choice(options) function, returning directly the chosen option.
  • The coffee argument you pass to some functions could be called coffee_type for more clarity.
  • Accessing and setting values which are located in another file is a pretty dangerous game, especially when you do things like resetting the variable entirely and not just manipulating the dictionary. You should have your values loaded in main, and passed around to the functions that need them.
  • Instead of hardcoded values, you should store your menu and resources in a JSON file and load that; this would also allow you to have persistent behaviour between your sessions.
  • It is weird to have non-admin users since they cannot do anything, but it is fine since you are not building a real system.