Message7529

Author zzzeek
Recipients zzzeek
Date 2012-11-19.16:34:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1353342867.03.0.989221952212.issue1990@psf.upfronthosting.co.za>
In-reply-to
Content
i.e.:

class Foo(object):
    class bar(object):
        bat = "hi"

from operator import attrgetter

print attrgetter("bar.bat")(Foo)

this is a pure Python workaround:

    def dottedgetter(attr):
        def g(obj):
            for name in attr.split("."):
                obj = getattr(obj, name)
            return obj
        return g
History
Date User Action Args
2012-11-19 16:34:27zzzeeksetrecipients: + zzzeek
2012-11-19 16:34:27zzzeeksetmessageid: <1353342867.03.0.989221952212.issue1990@psf.upfronthosting.co.za>
2012-11-19 16:34:26zzzeeklinkissue1990 messages
2012-11-19 16:34:26zzzeekcreate