[Python-Dev] Re: [Python-checkins] python/dist/src/Lib types.py,1.26,1.27

Skip Montanaro skip@pobox.com
Wed, 22 May 2002 11:58:09 -0500


    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.  

Given that types is not yet deprecated, I think that's a viable option.  I'd
be happy to see the types module deprecated, but it isn't at this point in
time, so I believe it should support BooleanType. 

    Guido> I think the plan is to stop recommending the types module --
    Guido> maybe deprecating it too.

deprecate-away-ly, y'rs,

Skip