Why does this python code work?
- by Int-0
I have written a simple python module, it has this code:
_log = logging.getLogger("mymodule")
_started = False
def set_log_level(level):
_log.setLevel(level)
if not _started:
_hdlr = logging.FileHandler('mymodule.log')
When I call set_log_level() program fails because symbol _started is not found. It is normal because global _started is missing in the method. But my question is: symbol _log has the same visibility as _started, so why does this symbol can be found?
BR,
// Toby