Why does `getattr` not support consecutive attribute retrievals?

Viewed 16388
class A(): pass

a = A()
b = A()

a.b = b
b.c = 1

a.b     # this is b
getattr(a, "b") # so is this

a.b.c   # this is 1   
getattr(a, "b.c") # this raises an AttributeError

It seemed very natural to me to assume the latter. I'm sure there is a good reason for this. What is it?

7 Answers
Related