[Python-Dev] PyMapping_Check Bug?

Guido van Rossum guido at python.org
Sat Aug 9 11:52:21 EDT 2003


> Passing along a fragment from the psycopg list where Federico Di Gregorio
> (fog at initd.org) wrote:
> 
>     .... because on python 2.3 PyMapping_Check apperently return True for
>     every new-type instance....
> 
> Is this true?  If so, is it a bug?

I don't see this.  operator.isMappingType() maps directly to
PyMapping_Check(); and I tried this:

    >>> import operator
    >>> operator.isMappingType(str)
    False
    >>> class C(object): pass
    ...
    >>> operator.isMappingType(C)
    False
    >>> operator.isMappingType(C())
    False
    >>> operator.isMappingType({})
    True
    >>>

Looks okay to me. :-)

--Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-Dev mailing list