I\'m a bit confused about types and classes in Python. For e.g. the following REPL conversation confuses me:
>>> class A: pass
...
>>> a = A()
You're encountering the different behavior for new style classes versus classic classes. For further reading read this: Python Data Model. Specifically read the section on classes and the difference between new style and classic classes.
Try typing the following into your REPL:
class A: pass
class B(object): pass
and you'll see that you get different results. Here you're dealing with the difference between new style and old style classes. Using Python 2.6.1 here's what I get:
> type(A)
> type(B)
which tells you that lists are new style classes and not old style classes. We can further play around with things using list
as well:
> type(list)
same as our class B(object): pass
result. And also
> c = []
> type(c)
which is telling you about the instance of the object and not it's definition.