Is x.f() <==>MyClass.f(x) a kind of algebraic structure?

Paul Boddie paul at boddie.org.uk
Mon Oct 23 08:03:19 EDT 2006


steve wrote:
> I thought that when read Guido van Rossum' Python tutorial.What can we
> think that?

That x.f() is equivalent to MyClass.f(x)? (Consider restating questions
in the body of messages to maintain context, by the way.)

Why not try it out?

>>> class MyClass:
...     def f(self):
...             print "I am", self
...
>>> x = MyClass()
>>> x.f()
I am <__main__.MyClass instance at 0x2a955d5b00>
>>> MyClass.f(x)
I am <__main__.MyClass instance at 0x2a955d5b00>

Paul




More information about the Python-list mailing list