Python In a Nutshell says that:
a method defined in a class body has a mandatory first parameter, conventionally named self , that refers to the instance on which you call the method.
Does a method of a class should have at least one parameter referring to an instance?
Is it a bad practice to create a method without any parameter?
Is it a good practice to always make a method work when calling it on either the class or an instance of the class?
Note that I am not talking about a static method or class method, but an ordinary method.
>>> class C5(object):
... def hello():
... print('Hello')
...
>>> C5.hello()
Hello
>>> C5().hello()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: hello() takes 0 positional arguments but 1 was given
Thanks.