[Python-Dev] Is X a (sequence|mapping)?

Tim Peters tim.one@home.com
Tue, 23 Jan 2001 17:02:41 -0500


>> 	operator.isMappingType()
>> 	+ some other C style _Check() APIs

[Guido]
> Yes, these should probably be deprecated.  I certainly have never
> used them!  (The operator module doesn't seem to get much use in
> general...

It's used heavily by test_operator.py <wink>.  Outside of that, it's used
maybe three times in the std distribution, nowhere essential; the

    return map(operator.__div__, rgbtuple, _maxtuple)

in Pynche's ColorDB.py is typical.  2.0's

    return [x / 256. for x in rgbtuple]

does the same thing more clearly (_maxtuple is a module constant).

It appeals to functional-language fans and extreme micro-optimizers, so they
don't have to type "lambda" in the simplest cases.  At least
operator.truth(x) is *clearer* than "not not x".

> Was it a bad idea?)

Mixed, but I'd say more bad than good overall.