Or perhaps this was meant to deter a developer from using the global statement.
The logging function is something I want to instantiate on any files that logs and it seems safe if I define it everywhere.
The logging module is intended to be thread-safe without any special work needing to be done by its clients. It achieves this though using threading locks; there is one lock to serialize access to the module’s shared data, and each handler also creates a lock to serialize access to its underlying I/O.https://docs.python.org/3/library/logging.html#thread-safety
Hello!
I wanted to read more on the references on this page https://docs.quantifiedcode.com/python-anti-patterns/maintainability/using_the_global_statement.html
I know the book entails things you should "NEVER" do in practice. So I ask this in the context of putting things in the global scope.
Do we consider instantiating built in modules like logger anti patterns? Or should this be something that should be encapsulated in its own class.
Or perhaps this was meant to deter a developer from using the
global
statement.The logging function is something I want to instantiate on any files that logs and it seems safe if I define it everywhere.
The logging module is intended to be thread-safe without any special work needing to be done by its clients. It achieves this though using threading locks; there is one lock to serialize access to the module’s shared data, and each handler also creates a lock to serialize access to its underlying I/O.
https://docs.python.org/3/library/logging.html#thread-safety