So I try:
r = ring_int (10)
r.__len__ = lambda: 10
This doesn't work:
TypeError: object of type 'ring_int' has no len()>>len(r)
It appears that __len__ is being looked up only on the class dict, not the instance dict? What's the correct way to do this? (Of course, I could just use inheritance, but this is an opportunity for me to learn more about python)