[Python-ideas] PEP 484 (Type Hints) -- second draft

Nathaniel Smith njs at pobox.com
Mon Mar 23 22:17:20 CET 2015


On Mar 23, 2015 1:03 PM, "Guido van Rossum" <guido at python.org> wrote:
>
> On Sun, Mar 22, 2015 at 11:02 PM, David Foster <davidfstr at gmail.com>
wrote:
>>
>> * +1 for the argument order cast(x, T). This is consistent with (x: T)
elsewhere.
>
>
> I disagree on this. It goes against the argument order of casts in other
languages, e.g. C, C++, Java, and even in Python -- you write int(x), not
x(int).

I don't have any strong opinion here, but I don't find the consistency
argument convincing. In int(x), 'int' is the verb, and in English verbs
come before undergoers ("I am inting the x"). In cast(...), though, cast is
the verb, x remains the undergoer, and int is conceptualized as the
destination (or something like that), and destinations go in prepositional
clauses after the object. You'd say "I'm casting the x to int"; (cf "I'm
throwing the ball to Sarah"). "I'm casting to int the x" is extremely weird.

-n
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150323/efb80a21/attachment.html>


More information about the Python-ideas mailing list