Python: Difference between revisions

165 bytes added ,  28 July 2020
Line 304: Line 304:
===Static and Class methods===
===Static and Class methods===
See [https://realpython.com/instance-class-and-static-methods-demystified/ realpython]
See [https://realpython.com/instance-class-and-static-methods-demystified/ realpython]
Note that the Google Python style guide discourages use of static methods.
Class methods should only be used to define alternative constructors (e.g. fromMatrix).


<syntaxhighlight lang="python">
<syntaxhighlight lang="python">