Hello Erik,

First of all, some updates. There is an actual PEP now:

https://www.python.org/dev/peps/pep-0575/

I already started on an implementation:

https://github.com/jdemeyer/cpython/tree/pep575

On 2018-04-09 19:03, Erik Bray wrote:
The
one thing I keep questioning is whether it makes sense to include the
descriptor functionality (i.e. __get__) on the basefunction class.  It
seems a bit strange to me because it's a bit of tacked-on
functionality that isn't even necessarily needed by "functions"

I don't really understand you here. I think that it's very natural for a function to behave like an unbound method because that's how Python functions work. You even say that yourself:

although we do want most functions to behave as unbound methods.

Further, it breaks backwards-compatibility for builtin_function.

No, it does not because builtin functions behave as already-bound by the module (this is kind of strange, but that's how it is):

>>> import sys; sys.exit.__self__
<module 'sys' (built-in)>

Already-bound methods cannot be bound again so these functions do *not* behave like unbound methods.

To fix this for future functions, I propose a METH_BINDING flag. This prevents setting __self__ such that those builtin functions really do behave like unbound methods.

I also don't like that basefunction is spelled without an underscore
(no doubt inspired by basestring), but its subclasses
(generic_function, etc.) are spelled with an underscore.  That's just
a minor nitpick.

Sure. Speaking of naming, at least one person complained about "generic_function" because that name clashes with "generic function" in the sense of PEP 443. So if you have suggestions for that...

Let me know if you want any help with the prototype implementation.
Not that I think you need help, but if you think there's some sensible
way to divvy up the work I'm happy to take part.  Perhaps we can work
on that at Cernay if you haven't already started.

I was hoping to have a more-or-less finished implementation by that time, so we could discuss that.

--
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to