Type hinting of Python is just a toy ?

Chris Angelico rosuav at gmail.com
Fri Jan 4 03:17:51 EST 2019


On Fri, Jan 4, 2019 at 7:06 PM iamybj--- via Python-list
<python-list at python.org> wrote:
>
> I read that pep 484 type hinting of python has no effect of performance, then what’s the purpose of it? Just a toy ?

Yep, it's just a toy. There's absolutely no reference anywhere in the
PEP to "rationale and goals", or any mention of use-cases, or anything
like that. The Python core devs just felt like making the language
more complicated for no reason. It definitely doesn't have anything to
do with making it easier to find bugs, or giving IDEs and linters more
tools to work with.

> Python is an old programming language, but not better than other programming languages, then what are you all dong for so many times ?

Old by what definition? Most good programming languages have been
around since the 1990s or earlier. Some date back to the 70s. Fortran
has its origins in the 50s.

> Pep484 is too complex. Typle should not a seperate type, in fact it should be just a class. Like this in other programming language
> Python: Tuple(id: int, name: string, age: int)
> Other: class someClass {
>         public int id;
>         public string name;
>         public int age;
> }

In other words, you want typing to be as restrictive as it is in C++
or Java. How would you define the type "JSON-encodable"? You can
encode a string, an integer, a float, an array of JSON-encodable
objects, and a mapping from strings to JSON-encodable objects. Can you
represent that as a class?

> Design of OOP of python is too bad, so it treat Tuple as a seperate type.
>
> Why looks different than others? afraid of cannot been watched by others?

And this is the bit where I go, yep, troll, bye bye.

Except for the part where I delete your message without bothering to
reply, which is probably a mistake on my part.

ChrisA



More information about the Python-list mailing list