[Python-ideas] Structural type checking for PEP 484

Ryan Gonzalez rymg19 at gmail.com
Thu Sep 17 23:56:33 CEST 2015


Embedding type names in arguments and method names.

On Thu, Sep 17, 2015 at 4:45 PM, Sven R. Kunze <srkunze at mail.de> wrote:

> On 17.09.2015 23:19, Ryan Gonzalez wrote:
>
>> def process_integer_coordinate_tuples(integer_tuple_1, integer_tuple_2,
>> is_fast): ...
>>
>> vs
>>
>> def process_coords(t1: Tuple[int, int], t2: Tuple[int, int], fast: bool):
>> ...
>>
>> Java's fatal mistake.
>>
>
> Care to elaborate?
>

You said:

> Even good variable names can leave the type ambiguous.

These are names that don't leave anything ambiguous! :D

Really, though: relying on naming to make types explicit fails badly
whenever you start refactoring and makes hell for the users of the API you
made.

-- 
Ryan
[ERROR]: Your autotools build scripts are 200 lines longer than your
program. Something’s wrong.
http://kirbyfan64.github.io/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150917/07f9601b/attachment.html>


More information about the Python-ideas mailing list