Author vinay.sajip
Recipients Trundle, daniel.urban, eric.araujo, eric.snow, ezio.melotti, python-dev, terry.reedy, vinay.sajip
Date 2011-10-20.15:10:16
SpamBayes Score 3.81106e-05
Marked as misclassified No
Message-id <1319123417.12.0.473380673552.issue12915@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2011-10-20 15:10:17vinay.sajipsetrecipients: + vinay.sajip, terry.reedy, ezio.melotti, eric.araujo, Trundle, daniel.urban, python-dev, eric.snow
2011-10-20 15:10:17vinay.sajipsetmessageid: <1319123417.12.0.473380673552.issue12915@psf.upfronthosting.co.za>
2011-10-20 15:10:16vinay.sajiplinkissue12915 messages
2011-10-20 15:10:16vinay.sajipcreate