Skip to content

bpo-30530: Descriptor HowTo: update Function.__get__ #1845

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Doc/howto/descriptor.rst
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ this::
. . .
def __get__(self, obj, objtype=None):
"Simulate func_descr_get() in Objects/funcobject.c"
return types.MethodType(self, obj, objtype)
return types.MethodType(self, obj)
Copy link
Contributor

@DimitrisJim DimitrisJim May 29, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A relic of the unbound-method days, seems it was never removed when the rest was. A relic of the unbound-method days, seems it was never removed when the rest was in the ff73795 changeset.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want me to remove that as well? I left it because I think the signature should match __get__(self, instance, owner) as in regular descriptors right?

btw, I did sign the CLA, please check and let me know if I need to review.

Copy link
Contributor

@DimitrisJim DimitrisJim May 29, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want me to remove that as well?

You're right, it should match, it was my initial brainfart.

I did sign the CLA, please check and let me know if I need to review.

You should wait at least a day until it gets checked, see https://docs.python.org/devguide/pullrequest.html#licensing


Running the interpreter shows how the function descriptor works in practice::

Expand Down