Skip to content

Instantly share code, notes, and snippets.

@amerlyq
Last active August 3, 2017 13:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amerlyq/ae514cc5d722d8bfa9518be66eadf3bc to your computer and use it in GitHub Desktop.
Save amerlyq/ae514cc5d722d8bfa9518be66eadf3bc to your computer and use it in GitHub Desktop.
# SEE: https://docs.python.org/3/reference/datamodel.html#special-method-lookup
class A(object):
pass
class B(object):
def __init__(self): self.a=A()
def __getattr__(self, n): print(n)
b = B()
print(b.__iter__)
print(iter(b))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment