r/ProgrammerHumor • • Aug 26 '20

Python goes brrrr

Post image
59.2k Upvotes

789 comments sorted by

View all comments

Show parent comments

2

u/nemec Aug 26 '20

No, that's immediate evaluation. Imagine this is the definition of log:

def log(fmt, *args):
    if LOGGING_IS_ENABLED:
        print(fmt.format(*args))

Note how the arguments aren't formatted into the string unless logging is enabled. In your example, the log method would see only one string argument.

1

u/mxzf Aug 27 '20

Fair enough. I haven't actually dug into the implementation of logging.