Ah, pretty Python.
Thanks, all.
--
http://mail.python.org/mailman/listinfo/python-list
David S. wrote:
> Does something like operator.getattr exist to perform a chained attr
> lookup?
>
> I came up with the following, but I can not help but think it is
> already done and done better.
You were on the right track, but the built-in getattr is a perfectly
good argument to reduce(), usin
Alexey Borzenkov wrote:
> Do you mean something like
>
> class cattrgetter:
> def __init__(self, name):
> self.names = name.split('.')
> def __call__(self, obj):
> for name in self.names:
> obj = getattr(obj, name)
> return obj
I'll raise you one:
def c
On Oct 25, 10:00 pm, "David S." <[EMAIL PROTECTED]> wrote:
> Does something like operator.getattr exist to perform a chained attr
> lookup?
Do you mean something like
class cattrgetter:
def __init__(self, name):
self.names = name.split('.')
def __call__(self, obj):
for nam
Does something like operator.getattr exist to perform a chained attr
lookup?
I came up with the following, but I can not help but think it is
already done and done better.
Peace,
David S.
def compose(funcs):
""" return composite of funcs
this does not support extended call syntax, so