Q:

Python: class instance created with no argument

When I declare a class, say, 
class MyClass: 
    def __init__(self, value):
        self.data = value 
    def show(self):
        print self.data`

then creating an instance
A = MyClass(1)

behaves as I would expect (the output of A.show is 1). But when I create an instance without the argument
B = MyClass

and then set the value manually 
B.data = 2 

calling B.show returns the TypeError: unbound method show() must be called with MyClass instance as first argument (got nothing instead).
Can someone explain me why?

A:

B is another name for the class definition MyClass.
B.data = 2

creates an attribute named data on the class definition.
B.show is a reference to the function defined on MyClass. It is an instance function and expects to be called on an instance of MyClass (which is what A is, but not what B is).
The instance is implicitly passed as the first argument to the function. You can explicitly call the function with an instance:
B.show(A)

