[Python-Dev] PEP 563: Postponed Evaluation of Annotations

Ivan Levkivskyi levkivskyi at gmail.com
Thu Nov 2 15:21:00 EDT 2017


On 2 November 2017 at 18:00, Brett Cannon <brett at python.org> wrote:

>
>
> On Thu, 2 Nov 2017 at 08:46 Steven D'Aprano <steve at pearwood.info> wrote:
>
>> On Wed, Nov 01, 2017 at 03:48:00PM -0700, Lukasz Langa wrote:
>> [...snip...]
>
> I think the performance bit is really the big deal here.
>
>
I don't think so. Although subscripting generics is indeed very expensive,
this is heavily optimised
by various caches. I think PEP 560 might actually have comparable (or even
bigger) performance effects.

IIUC performance is listed second in the PEP for a reason. I am OK with
using quotes for forward references, but I have seen
many people complaining about this (especially novices). I think Jukka is
right here.

We can't allow all unquoted forward references but those that will still be
quoted appear in more advanced situations
like bounded type variables and derived generics. But in these cases it is
clear that a forward reference appears
in runtime context.

--
Ivan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20171102/e7640e78/attachment.html>


More information about the Python-Dev mailing list