[Python-Dev] PEP 563: Postponed Evaluation of Annotations (original) (raw)

Lukasz Langa lukasz at langa.pl
Sun Nov 5 23🔞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.



More information about the Python-Dev mailing list