-
-
Notifications
You must be signed in to change notification settings - Fork 30.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
functools.partialmethod
simplification
#124652
Comments
Note that |
PR is ready for review. Quick summary of what I have done and thought of:
E.g.: class D:
def __get__(self, obj, cls):
return (lambda a, b: None)
class A:
d = D()
@staticmethod
def s(a, b):
pass
@classmethod
def c(self, a, b):
pass
ps = staticmethod(partial(s.__wrapped__, 1))
pc = classmethod(partial(c.__wrapped__, Placeholder, 1))
pd = ? # needs `partialmethod` Thus, I have modified This allowed removing More details in description of PR. |
Feature or enhancement
Proposal:
Now, as
partial
has__get__
andPlaceholder
it is probably a good idea to simplifypartialmethod
.So the mental model of
partialmethod
can simply be:partial
, which always has the first argument set toPlaceholder
.So
partialmethod
could maybe be a subclasspartial
, which would potentially simplify things.Also, maybe there is a way so that
partialmethod
can be made obsolete altogether.Will see where I can get to with this.
Any ideas welcome.
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
#121027
#119827 (comment)
Linked PRs
The text was updated successfully, but these errors were encountered: