AIDungeonAPI icon indicating copy to clipboard operation
AIDungeonAPI copied to clipboard

Some code refactoring

Open sasha00123 opened this issue 4 years ago • 0 comments

Well, I moved my project to your library(only previously existed functionality, yet): https://github.com/sasha00123/ai-dungeon-bot/commit/246739acb3485630825236ee1ebb093e0333db4d

And, well, it works! I didn't take that long, actually. Thank you for your work.

But there are few little arguable moments in your coding style.

  1. Async constructors - maybe it's better to make init function outside the constructor? Just kills an autocompletion and gives a bunch of warnings.
  2. Camel case for variables - eventName, ScenarioIDS - I believe it's better to use event_name, SCENARIO_IDS
  3. Mutable default values for parameters, it's better to use None. More info here
  4. Default functions shadowing - type, id. You should consider changing it to something like action_type, adventure_id, etc.
  5. Some spacing - between function parameters, equality signs, etc.

More info you can find here: https://www.python.org/dev/peps/pep-0008/

In fact, any linter or powerful IDE like PyCharm could help to find and fix such mistakes much quicker.

sasha00123 avatar Aug 01 '20 17:08 sasha00123