operator.isMappingType

John Roth newsgroups at jhrothjr.com
Sat Nov 1 21:32:34 EST 2003


"Peter Hansen" <peter at engcorp.com> wrote in message
news:3FA465CC.8F11293D at engcorp.com...
> 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...

I see. That did look odd...

John Roth
>
> -Peter






More information about the Python-list mailing list