Setting a module package to use new-style classes

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


Ben Finney <bignose+hates-spam at benfinney.id.au> wrote:

> "Panos Laganakos" <panos.laganakos at gmail.com> 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.


Alex



More information about the Python-list mailing list