operator.isMappingType

Peter Hansen peter at engcorp.com
Sat Nov 1 21:02:52 EST 2003


John Roth wrote:
> 
> "Raymond Hettinger" <vze4rx4y at verizon.net> wrote in message
> news:vgYob.46447$4O1.17443 at nwrdny01.gnilink.net...
> > Since the advent of extended slicing, operator.isMappingType() returns a
> > misleading result.
> >
> > >>> map(operator.isMappingType, ([], (), {}, '', u''))
> > [True, True, True, True, True]
> >
> >
> > I recommend removing it from the operator module.
> 
> I get the following on 2.2.3:
> 
> >>> map (operator.isMappingType,([], {}, (), ", u"))
> [0, 1, 0, 0]
> 
> Where did the fifth True come from? That's really odd!

Raymond used pairs of single quotes, while you used only
individual double-quotes surrounding a string containing
a comma, a space, and the letter u.  His had an empty
string and an empty unicode string...

-Peter




More information about the Python-list mailing list