I'm coming to Python from Java. I'm still getting a feel for scoping
limits. For the sake of curiosity, is there another way to refer to a
package besides name?
The only way to refer to anything is by its name -- or, from a name and
through subscript/dot notation if you've stored something in a container.
But a package (and anything else) can have many names, and it really has
no idea what they are.
You can do "import logging as logging_package" which is just a shortcut for:
import logging
logging_package = logging
del logging
And such.
That said: The frameworks I've seen that shadow the global 'logging'
package with a specific logger do so somewhat on purpose (though I find
the practice slightly dubious), so that naive code which previously just
used the general root logger would work with the more specific one
seamlessly.
But such frameworks usually also have a setup/environment sort of file
where this is not done, and that's where things like adding handlers
belongs.
Just as an aside.
Renaming "logging = ..." to "logger = ..." is probably a better solution
anyways
--
Stephen Hansen
... Also: Ixokai
... Mail: me+list/python (AT) ixokai (DOT) io
... Blog:
http://meh.ixokai.io/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.10 (Darwin)
iQEcBAEBAgAGBQJMF6mdAAoJEKcbwptVWx/lR1AH/Rd8jYEadfTxFWgyGwyEih8C
uMiNEbNMig40+SquZTBAaCOLJpBQ4R1Nygf717r6vrJeMqK/e1ATruHl6eEAMdnI
kfPtdEE1IQCxrblrVkYssoOrjYcJnXNq0FKUamSU89Kbvaj5iMUxVzSAEyeD3nbC
KFmAffjWu1Mw63J+iPV/wKVXK9N4PPfdoTA/SRH6lj11salFgrQDfNR09REVa7XG
2qIUAC5QvYr45Ob5+tVvNTn+VLp8nkfJvv8ecK0k2ynRO1HnudcFjwOFHzbqKPL0
9OmOhtsugJoPa9cmWAacxOsBdzgcINyRWSnpvx4VJ7z5LlcCiwXxmGfFvj3rmVA=
=k85Z
-----END PGP SIGNATURE-----