Skip to content

Instantly share code, notes, and snippets.

@geniusnhu
Created August 23, 2021 01:12
Show Gist options
  • Save geniusnhu/6ee2711c65435b728a758b77c749ea84 to your computer and use it in GitHub Desktop.
Save geniusnhu/6ee2711c65435b728a758b77c749ea84 to your computer and use it in GitHub Desktop.
Example of code annotation for a function and class
## Example of code annotation for a function
def your_function(X):
""" Explanation of what the function does
Parameters
----------
X: dtype
explanation of X
y: dtype
explanation of y
Returns
-------
result: dtype
explanation of result
"""
X = y**2
return X
# ==============================================================================
### Example of code annotation for a class and its parameter, attribute & method
class YourClass():
""" Explanation of what the class does
Parameters
----------
data: dtype
explanation of data
"""
def __init__(self, data):
self.data = data
def inside_method(self):
""" Explanation of what the function does
Parameters: --
Returns:
-------
result: dtype
explanation of result
"""
result = self.data + 2
return result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment