subclass of object
Alf P. Steinbach
alfps at start.no
Fri Apr 2 07:45:49 EDT 2010
* Jason Friedman:
> Hi, what is the difference between:
>
> def MyClass(object):
> pass
>
> and
>
> def MyClass():
> pass
If you really meant 'def', then the first is a routine taking one argument, and
the second is a routine of no arguments.
If you meant 'class' instead of 'def', then it depends on the Python version.
In Py2 the first then defines a new-style class, while the second defines an
old-style class. E.g. you can see some difference by checking with 'isinstance'.
In Py3 there's no difference.
Cheers & hth.,
- Alf
More information about the Python-list
mailing list