|
|
Log in / Subscribe / Register

Re: Type hints -- a mediocre programmer's reaction

From:  Arnaud Delobelle <arnodel-AT-gmail.com>
To:  Cory Benfield <cory-AT-lukasa.co.uk>
Subject:  Re: Type hints -- a mediocre programmer's reaction
Date:  Tue, 21 Apr 2015 09:56:07 +0000
Message-ID:  <CAJ6cK1bZ61qfqmrfFm+23L-7MtxaUJdQqq4REc=CC8rC3LkFwg@mail.gmail.com>
Cc:  Python Dev <python-dev-AT-python.org>

On Tue, 21 Apr 2015 at 09:59 Cory Benfield <cory@lukasa.co.uk> wrote:
[...]

> Further, Python's type system is not sufficiently flexible to allow
> library authors to adequately specify the types their code actually
> works on. I need to be able to talk about interfaces, because
> interfaces are the contract around which APIs are build in Python, but
> I cannot do that with this system in a way that makes any sense at
> all. To even begin to be useful for library authors this PEP would
> need to allow some kind of type hierarchy that is *not* defined by
> inheritance, but instead by interfaces. We've been discouraging use of
> 'type' and 'isinstance' for years because they break duck typing, but
> that has *nothing* on what this PEP appears to do to duck typing.
>
> This is why I feel like this PEP may be a real threat to duck typing.  If
people constantly get told by their editor / IDE that they are calling
function with the wrong argument types, what are they going to do?  They
may start adopting the same approach as in Java / C++ etc... where
interfaces must be explicitly defined and the practice of duck typing may
become forgotten because discouraged by the tools programmers use.

I guess what I'm saying is that this could encourage a very significant
cultural change in the way Python code is written towards a less flexible
mindset.

-- 
Arnaud



to post comments


Copyright © 2015, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds