Setting a module package to use new-style classes
Ben Finney
bignose+hates-spam at benfinney.id.au
Mon May 1 17:44:41 EDT 2006
"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
In general, code in one module doesn't magically affect other modules.
> Maybe by declaring the __metaclass__ in the module's __init__.py?
Presumably you mean "the package's __init__.py", which is itself a
separate module; so no.
--
\ "I hate it when my foot falls asleep during the day, because |
`\ that means it's gonna be up all night." -- Steven Wright |
_o__) |
Ben Finney
More information about the Python-list
mailing list