On 11/14/06, Bill Janssen <[EMAIL PROTECTED]> wrote:
> Greg Ewing wrote:
> > Bill Janssen wrote:
> >
> > > Duck typing is a seriously bad idea, forced on Python by the now
> > > obsolete split between built-in types and user-defined types.
> >
> > Non-duck typing is a seriously bad idea, forced
> > on some other languages by static typing. Python
> > is mercifully free of such constraints.
>
> I'm thinking that Mike Orr's question, "are we all talking about the
> same duck-typing", makes sense.  Greg, I'm not suggesting static
> typing -- I much prefer dynamic strong typing.  But what Python has
> now is dynamic weak typing, which makes programs (particularly
> frameworks) fragile.  And it's mainly due to the historical accident
> of not being able to inherit from C-based types in Python 1.x.
>
> I'd like to be able to look at a value and determine which interfaces
> I can safely invoke on it, even if I don't understand its full type.
> I can't (safely) do that by string-matching method names.

I can't completely disagree with everything you say (introspection of
interfaces makes sense, and this is proven by that several frameworks
have implemented an explicit notion of interfaces).

But I object to your claim that it was invented because of the
difference between C and python types/classes in Python versions <=
2.1. The real reason was (and is) that there are no type declarations
in Python, so there is absolutely no reason why you *couldn't* pass
anything with an appropriate append() method to the following
function:

 def foo(x):
  x.append(42)

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to