[Python-Dev] Removing types module from stdlib

Fredrik Lundh fredrik@pythonware.com
Fri, 31 May 2002 18:01:55 +0200


raymond wrote:

> There were a couple of threads on comp.lang.py with headings like
> "isinstance considered harmful".  The conclusion was that most cases =
should
> have been coded some other way.  The legitimate uses included =
implementing
> multiple dispatch (supporting calls with type differentiated =
signatures) ,
> factory functions, decorator pattern (which needs to know if the =
object was
> previously decorated), and the composite pattern (which needs to know =
if it
> is dealing with an atom or a composite).

since when is comp.lang.py is an authority on anything?

> Here are some of the ideas for conversion:
>=20
> if type(x) is int     -->  if x=3D=3Dint(x)    # 3L would be passable

are these supposed to be equivalent, for any kind of x?  what
Python version are you using?

</F>