[stdlib-sig] proposed removal: the types module

Steven Bethard steven.bethard at gmail.com
Thu Apr 3 19:46:30 CEST 2008

On Thu, Apr 3, 2008 at 5:24 AM, Brett Cannon <brett at python.org> wrote:
> You can just call 'type' on something to get the type needed. And
>  practically all of the types listed are easy to get from some object
>  lying about that is of the proper type. Plus Guido supports its
>  removal. =)

It would be really helpful to see the patch that removes use of the
types module from the standard library. I counted over 100 imports of
the types module in the 2.6 standard library. Some of the fixes are
obvious, like::

    if type(etype) is types.ClassType

which in 3.0 should obviously be::

    if isinstance(etype, type)

But other ones are not as obvious to me::

    bdb.py:        if not isinstance(cmd, types.CodeType):
    bdb.py:        if not isinstance(expr, types.CodeType):
    copy.py:    d[types.CodeType] = _deepcopy_atomic
    idlelib/rpc.py:copy_reg.pickle(types.CodeType, pickle_code, unpickle_code)
    inspect.py:    return isinstance(object, types.CodeType)
    trace.py:        if isinstance(c, types.CodeType):

If someone could actually do the conversion, and show the new way to
write these things, I'd feel much more confident on removing the

I'm not *in*-sane. Indeed, I am so far *out* of sane that you appear a
tiny blip on the distant coast of sanity.
 --- Bucky Katt, Get Fuzzy

More information about the stdlib-sig mailing list