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

Paul Moore p.f.moore at gmail.com
Mon Mar 23 22:05:04 CET 2015


On 23 March 2015 at 19:55, Guido van Rossum <guido at python.org> 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).

However, in SQL, which is the only language I know of with an with an
explicitly named cast function (unless you count C++'s
static_cast<T>(foo) which isn't normal function syntax), the syntax is
CAST(foo AS type). So there's definitely a precedent (arguably
stronger, depending on your background) for cast(x, T).

Paul.


More information about the Python-ideas mailing list