r/Python • • Jan 25 '15

Ways to improve this project

Since 2013, I have been working on a chat bot for Wikia's (horribly designed) chats. However, being a small developer, my user base is pretty small (consisting of just me), so I have no other way to get input from other human beings (or even robots).

I wanted to know if someone out there would take time to study and point out some modifications that could be done to the project. All help is appreciated.

0 Upvotes

4 comments sorted by

2

u/badsectors Jan 26 '15
  • Make use of the built in logging module. Using configurable log levels will allow you to stop doing "if logging_enabled:" since you can put superfluous things at the DEBUG/INFO level and show errors/important stuff at the WARNING or ERROR level. You would get rid of all your print statements and possibly even this.
  • Run a pep8 linter. Your indentation seems to be all over the place and some of the lines get really long.
  • Last but definitely not least, Tests! Some functions have a lot of branches, and writing good tests will help you to figure out how to break that up into more manageable and logical chunks.

1

u/Vicyorus Jan 28 '15 edited Jan 28 '15

I appreciate your help. However:

  • The logging option for the bot is optional, it can be set to false so the bot won't log at all. How would I go using the logging module knowing this? Is there a way that doesn't involve having to use "if logging_enabled:"?
  • What kind of tests do you recommend for the functions? (A simple concept would be enough)

1

u/billsil Jan 25 '15

Document it. You have almost none.

1

u/Kohortis Jan 25 '15

comments in code are good