Message338193
I submitted a PR that addresses this and the next example, which also uses print unnecessarily.
To answer your last comment rhettinger; the preceding text tells you /why/ one might want to use a staticmethod:
"""
Good candidates for static methods are methods that do not reference the
``self`` variable.
For instance, a statistics package may include a container class for
experimental data. The class provides normal methods for computing the average,
mean, median, and other descriptive statistics that depend on the data. However,
there may be useful functions which are conceptually related but do not depend
on the data. For instance, ``erf(x)`` is handy conversion routine that comes up
in statistical work but does not directly depend on a particular dataset.
It can be called either from an object or the class: ``s.erf(1.5) --> .9332`` or
``Sample.erf(1.5) --> .9332``.
Since staticmethods return the underlying function with no changes, the example
calls are unexciting::
""" |
|
Date |
User |
Action |
Args |
2019-03-18 10:38:58 | carlbordum | set | recipients:
+ carlbordum, rhettinger, docs@python, bjonnh |
2019-03-18 10:38:58 | carlbordum | set | messageid: <1552905538.78.0.462182388117.issue23984@roundup.psfhosted.org> |
2019-03-18 10:38:58 | carlbordum | link | issue23984 messages |
2019-03-18 10:38:58 | carlbordum | create | |
|