[Python-Dev] class Foo(object) vs class Foo: should be clearly explained in python 2 and 3 doc

Alexander Belopolsky alexander.belopolsky at gmail.com
Sun Aug 10 17:51:51 CEST 2014


On Sat, Aug 9, 2014 at 8:44 PM, Steven D'Aprano <steve at pearwood.info> wrote:

> It is certainly required when writing code that will behave the same in
> version 2 and 3
>

This is not true.  An alternative is to put

__metaclass__ = type

at the top of your module to make all classes in your module new-style in
python2.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20140810/5e03505a/attachment.html>


More information about the Python-Dev mailing list