Next / Previous / Contents / TCC Help System / NM Tech homepage

26.1.4. Method calls in an old-style class

There are two different ways to call a method M of some class C:

Here is a demonstration of the equivalence of bound and unbound method calls.

>>> class C:
...     def __init__(self, x):
...         self.x = x
...     def show(self, y):
...         print "*** ({0},{1}) ***".format(self.x, y)
... 
>>> c=C(42)
>>> c.show(58)
*** (42,58) ***
>>> C.show(c,58)
*** (42,58) ***