isinstance() considered harmful

Alex Martelli aleax at
Fri Jan 25 13:25:23 CET 2002

"Jason Orendorff" <jason at> wrote in message
news:mailman.1011900037.7317.python-list at
> > Well, there are three proven ways to get fast compiled code by having
> > the compiler know what types it's compiling code for: [...]
> >
> > There's also a fourth way, Stalin-style type inference,
> I didn't know there was a programming language named after Stalin.

It's a compiler for the programming language Scheme, and it's
intended to mean "steel" in Russian rather than refer to any
historical figure adopting that as a codename:-).

> How does it differ from Java?

It's very hard to find anything in common between Scheme and Java.

Scheme and Python, despite totally-different syntax, do have
similarities, such as the lack of declarations (which makes
type inference technology developed for Scheme potentially
also interesting for Python).

> I'll talk more about interfaces later.  My question is,
> are explicit interfaces considered harmful too?

In my viewpoint they have both pluses and minuses.  Depending
on what I'm comparing with, and on what other technology and
infrastructure is available, the pluses may outweigh the minuses,
or vice versa.  For example, in Python, if PEP 246 was
implemented, then 'explicit interfaces' would IMHO become
a wonderful way to express 'protocols'.  Without PEP 246,
I think introducing interfaces might perhaps lead to a damaging
proliferation of typetesting and end up breaking more code
than it repairs -0- but maybe I'm just being pessimistic.


More information about the Python-list mailing list