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

Lukasz Langa lukasz at langa.pl
Sun Nov 5 23:18:07 EST 2017


> On 4 Nov, 2017, at 11:43 AM, Peter Ludemann via Python-Dev <python-dev at python.org> wrote:
> 
> If type annotations are treated like implicit lambdas, then that's a first step to something similar to Lisp's "special forms". A full generalization of that would allow, for example, logging.debug to not evaluate its args unless debugging is turned on (I use a logging.debug wrapper that allows lambdas as args, and evaluates them if debugging is turned on).

Interestingly enough, at Facebook we found out that using f-strings is *faster* at runtime than the lazy form of logging.log("format with %s and %d", arg1, arg2), including for cases when the log message is not emitted.

- Ł
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20171105/0b435fde/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Message signed with OpenPGP
URL: <http://mail.python.org/pipermail/python-dev/attachments/20171105/0b435fde/attachment.sig>


More information about the Python-Dev mailing list