That would imply that I cannot create instances of a type, only of
a class that implements the type, wouldn't it?
But Python denotes 'int' as a type *and* I can instantiate it.
Now I start getting confused also ;-)
>>> a=5
>>> a.__class__
<type 'int'>
>>> a.__class__.__class__
<type 'type'>
>>> dir(a)
['__abs__', '__add__', '__and__', '__class__', '__cmp__', '__coerce__',
'__delattr__', '__div__', '__divmod__', '__doc__', '__float__',
'__floordiv__', '__getattribute__', '__getnewargs__', '__hash__',
'__hex__', '__index__', '__init__', '__int__', '__invert__', '__long__',
'__lshift__', '__mod__', '__mul__', '__neg__', '__new__', '__nonzero__',
'__oct__', '__or__', '__pos__', '__pow__', '__radd__', '__rand__',
'__rdiv__', '__rdivmod__', '__reduce__', '__reduce_ex__', '__repr__',
'__rfloordiv__', '__rlshift__', '__rmod__', '__rmul__', '__ror__',
'__rpow__', '__rrshift__', '__rshift__', '__rsub__', '__rtruediv__',
'__rxor__', '__setattr__', '__str__', '__sub__', '__truediv__', '__xor__']
I think in Python everything is implemented as a class which makes
sense. AFAIK you can implement a certain interface in a custom class and
it behaves like, for example, a builtin integer. But I guess one of the
gurus can clarify this matter with an appropriate URL ;-)
--
http://mail.python.org/mailman/listinfo/python-list