[Python-ideas] pep-0484 - Forward references and Didactics - be orthogonal

Joseph Jevnik joejev at gmail.com
Mon Aug 24 06:39:34 CEST 2015


What is the intended behavior if `Tree` is already a name in scope?

On Mon, Aug 24, 2015 at 12:19 AM, Prof. Dr. L. Humbert <
humbert at uni-wuppertal.de> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi,
> when looking at pep-0484 I find the *non-orthogonal* construction, which
> may lead to a misconcetion:
>
> What students should be able to code:
>
> 1. varinat
> #-------------wishful----------------------------------\
> class Tree:
>     def __init__(self, left: Tree, right: Tree):
>         self.left = left
>         self.right = right
>
>
> what students have to write instead:
>
> #-------------bad workaround----------------------------\
> class Tree:
>     def __init__(self, left: 'Tree', right: 'Tree'):
>         self.left = left
>         self.right = right
>
> /
> Please enable:
> from __future__ import annotations
>
> so the *first* variant should be possible
> \
> At this very moment (python 3.5rc1), it is not possible, but we need it,
> so the construction will be orthogonal from the point of view for
> students(!) - _one_ concept should work in different circumstances.
>
>         TNX
>         Ludger Humbert
> - --
> https://twitter.com/n770
> http://ddi.uni-wuppertal.de/
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2
>
> iEYEARECAAYFAlXam2MACgkQJQsN9FQ+jJ+RHgCfdcTgjVmZ3ULLwjerpJ3NdN7d
> NH8AoIvdTqWbkcfi7o8e7JuAYXbgZk0V
> =OMhU
> -----END PGP SIGNATURE-----
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150824/b860c2d6/attachment.html>


More information about the Python-ideas mailing list