Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save eclecticmiraclecat/c368d48f539ba270330acf5d70a90267 to your computer and use it in GitHub Desktop.
Save eclecticmiraclecat/c368d48f539ba270330acf5d70a90267 to your computer and use it in GitHub Desktop.
>>> class Foo:
... def __init__(self, x, y):
... self.x = x
... self.y = y
...
>>> f = Foo(x=2, y=3)
>>> f.x
2
>>> getattr(f, 'x')
2
>>> f.z = 30
>>> f.z
30
>>> setattr(f, 'z', 45)
>>>
>>> f.z
45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment