Considered implementing __isabstractmethod__ property for partial so that it returns it from the wrapped function. However, this is not a good idea, because in this case it would be impossible to set __isabstractmethod__ property for it. Also, it would be a divergent behaviour from FunctionType. In short, I kept the same abstract method attribute logic for partial and partialmethod as before.
Relaxed trailing placeholder restriction. This way the behaviour of object is more robust, more functional and behaves naturally given functionality definition. E.g. If I know that Placeholder is for positional arguments, then trailing placeholder will convert it to "positional only". And I can not see a good reason why trailing placeholders need to be prohibited. Also, such behaviour stems naturally from definition of functionality, while forbidding or automatically trimming trailing placeholders would require special mention in documentation.
partialmethod could be made redundant for standard method cases. However, there is one case that it is able to handle that could not be done without it, which is "Unknown descriptor" case, where partial needs to be applied at runtime on callable which is returned from __get__ of wrapped function.
Activity
rhettinger commented on Sep 27, 2024
Note that partialmethod also copies __isabstractmethod__ from the underlying callable.
add commented fix if merging after pythongh-124652
dg-pb commented on Oct 2, 2024
PR is ready for review.
Quick summary of what I have done and thought of:
E.g.:
Thus, I have modified partialmethod so that it does not do any heavy partial-like logic itself, but instead passes all of it to partial.
This allowed removing partialmethod special casing from inspect.signature.
More details in description of PR.
Merge remote-tracking branch 'upstream/main' into pythongh-124652-par…
dg-pb commented on Jan 6, 2025
Likely most convenient merge order
Merge remote-tracking branch 'upstream/main' into pythongh-124652-par…
Merge remote-tracking branch 'upstream/main' into pythongh-124652-par…
Merge remote-tracking branch 'upstream/main' into pythongh-124652-par…