On Tue, Apr 13, 2021 at 1:46 AM Hugh Fisher <hugo.fis...@gmail.com> wrote:

> In any Python 3.6 or later, type
>
>     >>> x : float = 1
>     >>> isinstance(x, float)
>
> or replace the second line with
>
>     >>> type(x)
>
> As someone who has programmed in FORTRAN, Pascal, C/C++,
> Java, and Go this is not at all what I consider reasonable. I do not
> believe other programmers with experience in typed languages
> would expect this behaviour either.
>

I have 30 years experience in other programming languages (C, C++, Pascal,
Java...) and I'm OK with this behaviour :)

Python is, historically, a dynamically typed language, and gradual typing
(see https://en.wikipedia.org/wiki/Gradual_typing) has been progressively
added to it in the last decade or so. This is a legitimate approach, both
from an academic and industrial point of view, and similar (with some
variants) to what has been done also for JavaScript, Ruby, PHP, Lua, Perl,
Scheme, etc. over the same period.

See for instance
https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.683.8854&rep=rep1&type=pdf
for more references.


> If typing is the future of Python, and the number of PEPs being
> worked on suggests that it is, then type checking should be
> integrated into CPython itself.
>

No need to integrate in CPython, one can already provide runtime type
checking using the current language, see e.g.
https://pypi.org/project/typeguard/


> An alternative is the TypeScript/JavaScript model, where typed
> Python becomes a distinct programming language that cannot
> be executed directly by the Python interpreter.
>

There are a few compile-to-Python languages out there (See a list here:
https://github.com/sfermigier/awesome-functional-python#languages ), some
with desirable (for some people at least) characteristics (homoiconic
syntax, language-level support for actors and functional programming,
pattern matching, etc.). They have very limited success in terms of
adoption which is probably a lesson to keep in mind.

  S.


-- 
Stefane Fermigier - http://fermigier.com/ - http://twitter.com/sfermigier -
http://linkedin.com/in/sfermigier
Founder & CEO, Abilian - Enterprise Social Software -
http://www.abilian.com/
Chairman, National Council for Free & Open Source Software (CNLL) -
http://cnll.fr/
Founder & Organiser, PyParis & PyData Paris - http://pyparis.org/ &
http://pydata.fr/
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/7TZPJ6F7W6LLWKRQIFP3EWFW4SYBY2XT/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to