a type without a __mro__?

Fredrik Lundh fredrik at pythonware.com
Sat Feb 5 07:17:35 EST 2005


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...?

something like this?

>>> import re
>>> x = re.compile("")
>>> x
<_sre.SRE_Pattern object at 0x00B2F7A0>
>>> x.__mro__
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
AttributeError: __mro__
>>> import copy
>>> type(x) in copy._deepcopy_dispatch
False

</F> 






More information about the Python-list mailing list