Don't wanna be here? Send us removal request.
Text
Today I learned that if you write something between two sets of three quotation marks in python, it's like doing a comment, kind of, and it's called a docstring. You use it to document your code. In the reST format, you use colons to describe parameters included in your code. On Stackoverflow.com, someone called daouzli put this example:
"""
This is a reST style.
:param param1: this is a first param
:param param2:
this is a second param
:returns: this is a description of what is returned
:raises keyError: raises an exception
"""
I had to look it up because my module in python coding was dropping it into all the examples without any context or explanation!
I also learned that you use def to declare a user-defined function which in plain talk would be a function that you've made and you use def to give it a name so you can call it up easily. For example, if you knew you might want to print a specific combination of things multiple times, you might make a function for it and call the function instead of writing out the whole combination every time.
8 notes
·
View notes