Compile time evaluation of dictionaries

John Nagle nagle at animats.com
Fri Mar 11 12:18:27 EST 2011


On 3/10/2011 8:23 AM, Gerald Britton wrote:
> Today I noticed that an expression like this:
>
> "one:%(one)s two:%(two)s" % {"one": "is the loneliest number", "two":
> "can be as bad as one"}
>
> could be evaluated at compile time, but is not:

    CPython barely evaluates anything at compile time.

				John Nagle



More information about the Python-list mailing list