On 09May2020 08:38, Steven D'Aprano <st...@pearwood.info> wrote:
On Fri, May 08, 2020 at 10:46:45PM +0300, Serhiy Storchaka wrote:
I propose to add the METH_GENERAL flag, which is applicable to
methods
as METH_CLASS and METH_STATIC (and is mutually incompatible with them).
If it is set, the check for the type of self will be omitted, and you
can pass an arbitrary object as the first argument of the unbound method.
Does this effect code written in Python? As I understand, in Python
code, unbound methods are just plain old functions, and there is no
type-checking done on `self`.
Aye. The whole purpose it to make it possible to provide this
convenience in C for certain methods. From the post:
For methods defined in Python you can pass arbitrary object as self.
But in methods defined in C it should be an instance of the class in
which the method was defined.
which is the impediment which motivates the proposal.
Cheers,
Cameron Simpson <c...@cskk.id.au>
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/python-ideas@python.org/message/XDGDD5LVICXUCEAXW5PC645HRGAY5RH4/
Code of Conduct: http://python.org/psf/codeofconduct/