On Sat, Feb 05, 2005 at 11:37:10AM +0100, Alex Martelli wrote: > Can anybody suggest where to find (within the standard library) or how > to easily make (e.g. in a C extension) a type without a __mro__, except > for those (such as types.InstanceType) which are explicitly recorded in > the dispatch table copy._deepcopy_dispatch...?
would this do what you need?
class C(type):
def __getattribute__(self, attr):
if attr == '__mro__':
raise AttributeError, "What, *me*, a __mro__? Nevah!"
return super(C, self).__getattribute__(attr)
class D(object):
__metaclass__ = C
instances of D have a type that behaves as if it didn't have a
__mro__. This isn't exactly what you asked for, but it might be
enough.
--
John Lenton ([EMAIL PROTECTED]) -- Random fortune:
El tiempo cura los dolores y las querellas porque cambiamos. Ya no somos la
misma persona.
-- Blaise Pascal. (1600-1662) Fil�sofo y escritor franc�s.
signature.asc
Description: Digital signature
-- http://mail.python.org/mailman/listinfo/python-list
