Vinay Sajip <[email protected]> added the comment:
The version in logging.config appears to be doing the same job, but is shorter:
def _resolve(name):
"""Resolve a dotted name to a global object."""
name = name.split('.')
used = name.pop(0)
found = __import__(used)
for n in name:
used = used + '.' + n
try:
found = getattr(found, n)
except AttributeError:
__import__(used)
found = getattr(found, n)
return found
The line "used = used + '.' + n" could of course be improved.
----------
nosy: +vinay.sajip
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue12915>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com