On Mon, Nov 16, 2020 at 6:51 PM Paul Sokolovsky <pmis...@gmail.com> wrote:
> As I mentioned, under "level 0", "from __future__ import const" has a
> magic meaning (akin to other "from __future__"'s). Under "level 1",
> "const" is just a normal annotation symbol imported from a module. So,
> following would be possible:
>
> =========
> from __future__ import const
>
> FOO: const = 1
>
> def fun():
>     const = 1  # Just a variable in function scope
>
>     def sub():
>         # Gimme powerz back
>         from __future__ import const
>         BAR: const = 2
>
>
> # Back to annotation in global scope
> BAZ: const = 3
> =========
>

SyntaxError: from __future__ imports must occur at the beginning of the file

If it's just a normal symbol imported from a module, it would have to
be from something other than __future__.

ChrisA
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/JHC3BIAQI752UAHYHHAJCIMWR4DRMP2T/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to