Setting a module package to use new-style classes

Alex Martelli aleaxit at
Wed May 3 04:45:10 CEST 2006

Ben Finney <bignose+hates-spam at> wrote:

> "Panos Laganakos" <panos.laganakos at> writes:
> > Is there a way to have a whole module package use the new-style
> > classes, without having to specify it per module-file or even worse,
> > per class definition?
> TTBOMK, you do that with a single statement per module, before any
> class definitions:
>     __metaclass__ = object

Almost: the assignment you need is

  __metaclass__ = type

but yes, it has to be per-module.


More information about the Python-list mailing list