[Python-Dev] PEP 294: Type Names in the types Module

Michael Hudson mwh@python.net
25 Jun 2002 00:09:38 +0100


Oren Tirosh <oren-py-l@hishome.net> writes:

> Abstract
> 
>     This PEP proposes that symbols matching the type name should be
>     added to the types module for all basic Python types in the types
>     module:
> 
>         types.IntegerType -> types.int
>         types.FunctionType -> types.function
>         types.TracebackType -> types.traceback
>          ...    
> 
>     The long capitalized names currently in the types module will be
>     deprecated.

Um, can I be a little confused?  If you are writing code that you know
will be run in 2.2 and later, you write

   isinstance(obj, int)

If you want to support 2.1 and so on, you write 

   isinstance(obj, types.IntType)

What would writing 

   isinstance(obj, types.int)

ever gain you except restricting execution to 2.3+?

I mean, I don't have any real opinion *against* this pep, I just don't
really see why anyone would care...

Cheers,
M.

-- 
  it's not that perl programmers are idiots, it's that the language
  rewards idiotic behavior in a  way that no other language or tool
  has ever done                         -- Erik Naggum, comp.lang.lisp