Python is DOOMED! Again!
Mario Figueiredo
marfig at gmail.com
Tue Jan 27 12:59:10 EST 2015
In article <mailman.18178.1422380228.18130.python-list at python.org>,
random832 at fastmail.us says...
>
> On Mon, Jan 26, 2015, at 19:11, Steven D'Aprano wrote:
> > random832 at fastmail.us wrote:
> > - lexical analysis has to look for twice as many files (it has to
> > hit the hard drive for a stub file before looking at the source),
> > and we know from importing that file system access is a
> > significant and expensive part of the process.
>
> The idea is that the type hinting files would not participate in
> execution at all, only static analysis, so the interpreter doesn't need
> to look for these things at all, it only needs to ignore them.
Like Steven, I do not agree with the idea of adding files for the
purposes of static analysis. But you make an important point.
Static analysis cannot and should not clutter executable code. Static
analysis doesn't require code execution. The Python interpreter doesn't
need to be called in. It is for this reason that it makes absolutely no
sense to for type hints to be mixed with our code. Let them reside in
comments, docstrings, external files, whatever. But never in our code.
I'm actually baffled that PEP 484 came into existence, let alone it
having any kind of supporter. Here we have a syntax that even requires
changes to the interpreter so it can safely ignore all the type hinting
clutter that is going to be added by anyone wanting to perform static
analysis.
And we should also be careful around the argument that type hints are
optional.
An optional feature says nothing of its requirements. The requirements
for PEP 484 are heavy. Not only will they force an update to the
interpreter, but will also force many users to reformate their function
headers in order for them to become bareable to the eye. In fact, no
longer will you look at function definitions like you did before.
And an optional feature says nothing of its usage patterns. Type hints
may be optional, but they may become a requirement for many projects. In
fact, the more complex your project, the more likely you are of wanting
to perform static analysis. It's not because type hints are optional
that I have some kind of choice about the matter. I may force myself, or
be forced, to use them. And if that is the case, I would rather prefer
having a syntax that doesn't clutter my ezxecutable code.
More information about the Python-list
mailing list