[Python-3000] Changing function-related TypeErrors

Bill Janssen janssen at parc.com
Sat May 6 06:07:04 CEST 2006


GvR writes:
> On 5/5/06, Bill Janssen <janssen at parc.com> wrote:
> > > > Is there anywhere else in Python where the type of an object isn't
> > > > checkable with isinstance()?
> > >
> > > Yes, it's called duck typing.
> >
> > And, in my opinion, it's probably worth stomping out in Py3K.  It
> > developed as necessary because of the original dichotomy between C
> > classes and Python classes in Python 1, but it's now obsolete.
> > Mix-ins should be used instead.
> 
> You want to get rid of all duck typing? That doesn't sound right to
> me. Anyway it isn't enforceable. I must be misunderstanding you.

Yes, I meant "get rid of all duck typing".  Duck typing is for
languages that can't do any better.  It's a weakness, not a strength.

Sure, it isn't enforceable (now, anyway), and I'm not sure I'd want it
to be (in Python).  But I think that the base language should be
defined terms of classes, many of which would be functional mixins,
rather than by which method names are or are not present in an
instance.  That is, "isinstance" should work properly everywhere with
the built-in and standard library types.

Bill


More information about the Python-3000 mailing list