Re: [Tutor] What protocol to follow when need to pick either one from __getattr__ and __getattribute__ ?

2019-04-23 Thread Alan Gauld via Tutor
On 23/04/2019 15:52, Arup Rakshit wrote: > If I replace __getattr__ with __getattribute__ I found the program works > exactly same. Now my questions is in real world when  you have to pick > between these 2 pair of special method which protocols a Python dev > checks to pick either of the one?

Re: [Tutor] What protocol to follow when need to pick either one from __getattr__ and __getattribute__ ?

2019-04-23 Thread Peter Otten
Arup Rakshit wrote: > I read today 2 methods regarding the customizing the attribute > access:__getattr__ and __getattribute__ from > https://docs.python.org/3/reference/datamodel.html#special-method-names. > What I understood about them is that __getattr__ is called when the > requested attribute

Re: [Tutor] What protocol to follow when need to pick either one from __getattr__ and __getattribute__ ?

2019-04-23 Thread Steven D'Aprano
On Tue, Apr 23, 2019 at 08:22:56PM +0530, Arup Rakshit wrote: > I read today 2 methods regarding the customizing the attribute > access:__getattr__ and __getattribute__ from > https://docs.python.org/3/reference/datamodel.html#special-method-names. > What I understood about them is that __getatt

[Tutor] What protocol to follow when need to pick either one from __getattr__ and __getattribute__ ?

2019-04-23 Thread Arup Rakshit
I read today 2 methods regarding the customizing the attribute access:__getattr__ and __getattribute__ from https://docs.python.org/3/reference/datamodel.html#special-method-names. What I understood about them is that __getattr__ is called when the requested attribute is not found, and an Attri