Re: [Tutor] self.name is calling the __set__ method of another class

2019-05-02 Thread Alan Gauld via Tutor
On 02/05/2019 16:25, Arup Rakshit wrote: > such frustrated abstractions. :) I don't know why python exposed so many > things, Because by exposing it those few who do need to play with the internals can(*). Most of us just ignore it > Python doesn't work the way I am thinking it, and I am far be

Re: [Tutor] self.name is calling the __set__ method of another class

2019-05-02 Thread Mats Wichmann
On 5/2/19 9:25 AM, Arup Rakshit wrote: > On 30/04/19 6:34 AM, David L Neil wrote: >> As Steven explained, this is a complex environment where only those >> with a good understanding of the meta abstractions would even want to >> play (IMHO). Perhaps you would be better served by actually writing >>

Re: [Tutor] self.name is calling the __set__ method of another class

2019-05-02 Thread Arup Rakshit
On 30/04/19 5:11 AM, Steven D'Aprano wrote: On Tue, Apr 30, 2019 at 12:47:02AM +0530, Arup Rakshit wrote: I really didn't write that code by myself. The day I'll you will not see me here everyday :) . I was watching a PyCon video https://youtu.be/81S01c9zytE?t=8172 where the author used this co

Re: [Tutor] self.name is calling the __set__ method of another class

2019-05-02 Thread Arup Rakshit
On 30/04/19 6:34 AM, David L Neil wrote: As Steven explained, this is a complex environment where only those with a good understanding of the meta abstractions would even want to play (IMHO). Perhaps you would be better served by actually writing some Python applications, and with such experien

Re: [Tutor] self.name is calling the __set__ method of another class

2019-04-30 Thread David L Neil
Hi Arup, On 30/04/19 5:55 AM, Arup Rakshit wrote: class NonBlank: def __init__(self, storage_name): self.storage_name = storage_name def __set__(self, instance, value): if not isinstance(value, str): raise TypeError("%r must be of type 'str'" % se

Re: [Tutor] self.name is calling the __set__ method of another class

2019-04-29 Thread Cameron Simpson
On 29Apr2019 23:25, Arup Rakshit wrote: In the following code, class attributes name and email is set to the instances of NonBlank. class NonBlank: def __init__(self, storage_name): self.storage_name = storage_name def __set__(self, instance, value): if not isinstance(valu

Re: [Tutor] self.name is calling the __set__ method of another class

2019-04-29 Thread Steven D'Aprano
On Tue, Apr 30, 2019 at 12:47:02AM +0530, Arup Rakshit wrote: > I really didn't write that code by myself. The day I'll you will not see > me here everyday :) . I was watching a PyCon video > https://youtu.be/81S01c9zytE?t=8172 where the author used this code. But > his explanation is not clear

Re: [Tutor] self.name is calling the __set__ method of another class

2019-04-29 Thread Arup Rakshit
On 29/04/19 11:40 PM, Steven D'Aprano wrote: On Mon, Apr 29, 2019 at 11:25:51PM +0530, Arup Rakshit wrote: Now I am not getting how the __set__() method from NonBlank is being called inside the __init__() method. Looks like some magic is going on under the hood. Can anyone please explain this h

Re: [Tutor] self.name is calling the __set__ method of another class

2019-04-29 Thread Steven D'Aprano
On Mon, Apr 29, 2019 at 11:25:51PM +0530, Arup Rakshit wrote: > Now I am not getting how the __set__() method from NonBlank is being > called inside the __init__() method. Looks like some magic is going on > under the hood. Can anyone please explain this how self.name and > self.email assignmen