Difference between type and class
Terry Reedy
tjreedy at udel.edu
Fri Aug 1 16:45:10 EDT 2008
Thomas Troeger wrote:
> Steven D'Aprano wrote:
>>> class A:
>>> def bar(self):
>>> print "A"
>>
>>
>> Alas, you've chosen the worst-possible example to "clarify" matters,
>> because old-style classic classes are *not* unified with types, and
>> will disappear in the future:
>
> Of course I wanted to write `class A(object)', but I keep forgetting
> this one because I'm still used to the old ways...
>
> Will this disappear in Python 3.0., i.e. can you again simply write
> class A:
> and inherit from object automagically?
Yes.
IDLE 3.0b2
>>> class a: pass
>>> a
<class '__main__.a'>
>>> a.__bases__
(<class 'object'>,)
3.0 is really a nicer version. Once the final release is out, the main
reason to stick with 2.x for new code will be if it depends on
third-party code (including your own ;-) that has not been upgraded.
More information about the Python-list
mailing list