MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/igvny1/python_goes_brrrr/g2yp29v
r/ProgrammerHumor • u/das_freak • Aug 26 '20
789 comments sorted by
View all comments
Show parent comments
2
No, that's immediate evaluation. Imagine this is the definition of log:
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.
1
Fair enough. I haven't actually dug into the implementation of logging.
logging
2
u/nemec Aug 26 '20
No, that's immediate evaluation. Imagine this is the definition of
log: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.