recursive function: use a global or pass a parameter?

Gregory Ewing greg.ewing at canterbury.ac.nz
Sat Jan 17 22:07:40 CET 2015


Roy Smith wrote:
> I will commonly put something like:
> 
> import logging
> logger = logging.getLogger("logger-name-for-my-module")

But that's not really a global variable, it's a
global constant. There's nothing wrong with those,
we use them all the time -- classes, functions, etc.

If you were to rebind logger to a different one from
time to time in your code, *then* it would be a global
variable, subject to the usual cautions.

-- 
Greg



More information about the Python-list mailing list