You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fromweakrefimportproxyclassAlpha:
def__len__(self):
return3def__reversed__(self):
returniter('cba')
def__hash__(self):
returnhash('abc')
a=Alpha()
# Direct use of the instance worksprint(len(a))
print(list(reversed(a)))
print(hash(a))
# Proxies can use the dunder methods directlyr=proxy(a)
print(r.__len__())
print(list(r.__reversed__()))
print(r.__hash__())
New changeset 96074de by Pablo Galindo in branch 'master': bpo-40523: Add pass-throughs for hash() and reversed() to weakref.proxy objects (GH-19946) 96074de
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: