> To get python to run the __get__ method I think you have to call > __getattr__ explicitly: > a.__getattr__('test') > > If you do: > a.test > python follows a different routine: it checks for the existence of the > attribute, then check if there is a __getattr__ attribute. Now the > speculative bit: then I conjecture that python assumes that > __getattr__ is a function with two arguments and directly passes them > on to it. Indeed > > type(a).__dict__['__getattr__'](a, 'test') > > seems to produce the same errors as a.test, whether the instance > attribute is set or not. > And this explain why there are too many arguments (error message > above). > > -- > Arnaud
So is this a python bug? I assumed it was seen as function but dont understand why it is like this. But interesting that if you call __getattr__ explicitly it works. Intuitevely I would assumet that the same route should be followed in both case. Maybe it is because __getattr__ is called only when you have an exception. /T -- http://mail.python.org/mailman/listinfo/python-list