[Python-Dev] PEP 573 -- Module State Access from C Extension Methods
Jeroen Demeyer
J.Demeyer at UGent.be
Tue Apr 24 13:12:34 EDT 2018
More information about the Python-Dev mailing list
Tue Apr 24 13:12:34 EDT 2018
- Previous message (by thread): [Python-Dev] PEP 573 -- Module State Access from C Extension Methods
- Next message (by thread): [Python-Dev] PEP 573 -- Module State Access from C Extension Methods
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 2018-04-24 16:34, Jeroen Demeyer wrote: > On the other hand, if you are passing the function object, then you can > get __self__ from it (unless it's an unbound method: in that case > __self__ is NULL and self is really args[0]). So there wouldn't be a > need for passing "self". I'm not saying that this is better than passing > "self" explicitly... I haven't yet decided what is best. One thing I realized from PEP 573: the fact that __self__ for built-in functions is set to the module is considered a feature. I never understood the reason for it (and I don't know if the original reason was the same as the reason in PEP 573). If we want to continue supporting that and we also want to support __get__ for built-in functions (to make them act as methods), then there are really two "selfs": there is the "self" from the method (the object that it's bound to) and the "self" from the built-in function (the module). To support that, passing *both* the function and "self" seems like the best way. Jeroen.
- Previous message (by thread): [Python-Dev] PEP 573 -- Module State Access from C Extension Methods
- Next message (by thread): [Python-Dev] PEP 573 -- Module State Access from C Extension Methods
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list