[Python-3000] Fwd: Conventions for annotation consumers (was: Re: Draft pre-PEP: function annotations)

Paul Prescod paul at prescod.net
Wed Aug 16 07:22:34 CEST 2006


On 8/15/06, Collin Winter <collinw at gmail.com> wrote:
>
>
> How exactly do they "deduce" what Bar is, just from the "from bar
> import Bar" line? pychecker would have to import and compile the Bar
> module first. What if being able to import bar depends on some import
> hooks that some other module (imported before bar) installed? I guess
> you'd have to follow the entire import graph just to make sure. Oh,
> and you'd have to end up running the module being analysed in case
> *it* installs some import hooks -- or maybe it defines Bar itself.


The end-user and the type checker creator can negotiate the boundary between
convenience and easy to parse syntax. At first the type checker creator
might say that things must be in a very predictable form with no variants
and no renames. Then they might do a bit more analysis and be able to handle
renames. Then they might evolve towards whole-program analysis and be able
to handle very complicated imports.

Surely you know that decorators can also be renamed, imported, etc. Same
with base classes (which are considered key to type checking). This is just
how Python works. Where people need to use static subsets of Python (like
RPython, or the "freeze" program or the compilable subset used by Jython)
they just define the subset and move on. The languages' core behaviour is
defined dynamically.

 Paul Prescod
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-3000/attachments/20060815/fa53a041/attachment.html 


More information about the Python-3000 mailing list