There are standard formats (I used the NumPy doc format above) which are helpful as they ensure documentation conventions and can be interpreted by some IDEs as well. In a sense, I was already using type annotations - via docstrings.ĭon't get me wrong: documenting your code with docstrings is great and useful when the component has a lot of logic. Let's see… a docstring that describes parameters, along with their types, and the output value along with its type… size : int, optional Number of numbers to return. Can you tell me what it does?ĭef randrange ( a, b, size = 1 ): """Return random numbers between a and b. I have written below a function whose body has been hidden. (Question 2/ could be answered just as easily with meaningful function names.) Let's play a quick game They were helping me to answer questions 1/ and 3/ at light speed.
0 Comments
Leave a Reply. |