Instantiating classes which are derived from built-in types.

Alex Martelli aleax at mail.comcast.net
Mon Nov 28 23:25:32 EST 2005


Paul Rubin <http://phr.cx@NOSPAM.invalid> wrote:

> aleax at mail.comcast.net (Alex Martelli) writes:
> > A is oldstyle -- a wart existing for backwards compatibility.
> 
> I think it's time for "from __future__ import newclasses" since
> I hate having to type "class A(object):" instead of "class A:"
> all over the place.

Use __metaclass__=type exactly in the same location where you'd want to
import from __future__ and you will get exactly the same functionality.


Alex



More information about the Python-list mailing list