Re: __set_name__ equivalent for instance

2023-11-16 Thread Dom Grigonis via Python-list
Thank you. > On 16 Nov 2023, at 21:30, Dieter Maurer wrote: > > Dom Grigonis wrote at 2023-11-16 21:11 +0200: >> ... >>> On 16 Nov 2023, at 21:00, Dieter Maurer wrote: >>> ... >>> Methods are not bound during instance creation, they are bound during >>> access. >> >> Good to know. What is the

Re: __set_name__ equivalent for instance

2023-11-16 Thread Dieter Maurer via Python-list
Dom Grigonis wrote at 2023-11-16 21:11 +0200: > ... >> On 16 Nov 2023, at 21:00, Dieter Maurer wrote: >> ... >> Methods are not bound during instance creation, they are bound during >> access. > >Good to know. What is the criteria for binding then? Does it check if its type >is `vanilla` function

Re: __set_name__ equivalent for instance

2023-11-16 Thread Dom Grigonis via Python-list
> On 16 Nov 2023, at 21:00, Dieter Maurer wrote: > > Dom Grigonis wrote at 2023-11-16 20:12 +0200: >> What I am interested in is a callback. >> Preferably just after methods get bound. So in `object.__new__`. > >> I have done it via metaclass, but it is not ideal as there would be too much >

Re: __set_name__ equivalent for instance

2023-11-16 Thread Dieter Maurer via Python-list
Dom Grigonis wrote at 2023-11-16 20:12 +0200: >What I am interested in is a callback. >Preferably just after methods get bound. So in `object.__new__`. >I have done it via metaclass, but it is not ideal as there would be too much >overhead. > >I think what I am looking for is custom method bindin

Re: __set_name__ equivalent for instance

2023-11-16 Thread Dieter Maurer via Python-list
Dom Grigonis wrote at 2023-11-15 18:44 +0200: >So there is a method __set_name__ which is called on class creation. > >The functionality that I am interested in is not retrieving name, but the fact >that it also receives `owner` argument. > >Thus, allowing simulation of bound class method. > >I wa

Re: __set_name__ equivalent for instance

2023-11-16 Thread Dom Grigonis via Python-list
What I am interested in is a callback. Preferably just after methods get bound. So in `object.__new__`. I have done it via metaclass, but it is not ideal as there would be too much overhead. I think what I am looking for is custom method binding. Regards, DG > On 16 Nov 2023, at 20:02, Dieter

__set_name__ equivalent for instance

2023-11-15 Thread Dom Grigonis via Python-list
So there is a method __set_name__ which is called on class creation. The functionality that I am interested in is not retrieving name, but the fact that it also receives `owner` argument. Thus, allowing simulation of bound class method. I was wandering if there is an equivalent functionality of