[Python-Dev] Re: [Python-checkins] python/dist/src/Lib types.py,1.26,1.27
Guido van Rossum
Wed, 22 May 2002 13:20:38 -0400
> Guido> I don't see where I'm forcing people to use isinstance().
> Assume you've got a module that uses elements of the types module. Now you
> need to add some code to it that manipulates boolean objects. Without
> BooleanType you have two choices:
> * convert all your uses of types.* objects to use isinstance()
> or "type(x) is something". Your code is uniform.
> * leave your use of types.* objects alone and just use
> isinstance() or "type(x) is bool" for boolean objects. Your
> code works, but treats booleans different than other objects.
> All I'm doing by adding BooleanType to types is providing a third option:
> * do nothing.
I'm still confused. How would you then *use* BooleanType? The only
uses for the types.* names I see are either with isinstance() or with
"type(x) is T". Apparently there's another use that I'm missing,
otherwise your first bullet would already be the "do nothing" case.
Can you give a code example using BooleanType?
--Guido van Rossum (home page: http://www.python.org/~guido/)