I'm sorry but I still have a question, look at this example:
>>> class test:
...     def __init__(self):
...         self.x = 1
...     def __getattr__(self, attr_name):
...         print attr_name
...         if attr_name == 'y':
...             return 2
...         else:
...             raise AttributeError, attr_name
...
>>> t = test()
>>> t.x
1
>>> t.y
y
2
>>> print t.x
1
>>> print t
__str__
__repr__
<__main__.test instance at 0xb7f6d6cc>

Since __str__ and __repr__ does not exist because their names was
printed, why not the "AttributeError" be raised?


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to