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
Class calling #51010
Comments
From: "Class instances The following program demonstrates otherwise regarding that last statement. def call(self):
print "inserted __call__ in object of class A"
class A(object):
def __call__(self):
print "__call__ method in class A"
x = A() # Equates: x = type(A).__call__(A)
x.__call__ = call
x() # Calls the method of class A.
x.__call__(x) # Calls function "call".
type(x).__call__(x) # The correct longhand of x() IMHO If I were to rephrase the documentation: |
On further reading it seems my objections only apply to new style classes. |
FYI, all special methods are (now) looked up on the type for new style So far I haven't thought of a rewording I like. The best I've come up Whatever we decide to do, section 3.4.4 will need a similar update. |
For some reason the 3.2 docs don't contain the sentence you reference, |
The PR uses a slight rewording of David's phrasing. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: