__metaclass__ = type (was: Re: if (__name__ == '__main__'): main(sys.argv[1:]))

François Pinard pinard at iro.umontreal.ca
Wed Apr 21 20:32:52 EDT 2004


[Lee Harr]
> On 2004-04-21, François Pinard <pinard at iro.umontreal.ca> wrote:

> > __metaclass__ = type

> Is there any reason to stick with old-style classes?

For your new programs, there is probably no good reason to worry about
old-style classes.  For your old programs, it is likely that you will
not meet problems on the average by the mere action of switching to
types.  However, there are areas of incompatibilities indeed, that one
may stumble upon, if one were pushing a bit deep in the internals.

> I mostly just create classes the old way and never even think about
> sub-classing object.

There are some new features, and corrections to previously debatable
features, which are not available in the old-style classes.  If you do
very simple uses of classes, always, you might choose to ignore the
difference.

-- 
François Pinard   http://www.iro.umontreal.ca/~pinard




More information about the Python-list mailing list