JamesDevJim / game-zulu

First game of the coolest project
0 stars 1 forks source link

Use docstrings #6

Open shuttle1987 opened 4 years ago

shuttle1987 commented 4 years ago

https://github.com/JamesDevJim/game-zulu/blob/9bf97d92194ff8e7d61785aa535806c37a14003a/shared/control.py#L94-L96

Can be re-written as follows:

class Control: 
   """This class reads all the inputs on the box. If box is not available then use the keyboard."""

This comes with a number of benefits with regards to tooling.

For example beforehand if we look at something like help(Control) we get no comment, whereas with my suggested change we get that documentation from the docstring from the tooling.

Beyond this there are a number of tooling related benefits from using the docstrings directly, mostly that you can automatically build a webpage of the documentation of your project by putting some documentation in these docstrings. There's tools like sphinx that does this.

JamesDevJim commented 4 years ago

I love commenting in code. Helps me understand what I did when I look back a couple weeks later. Perfect. Will start using docstrings.