Skip to content

Instantly share code, notes, and snippets.

@masak

masak/demo.txt Secret

Created June 23, 2015 09:16
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 masak/93815861a74c571c784f to your computer and use it in GitHub Desktop.
Save masak/93815861a74c571c784f to your computer and use it in GitHub Desktop.
Assigning to a random attribute in a method
$ python
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> class C(object):
... def foo(self):
... self.bar = 42
...
>>> c = C()
>>> c.foo()
>>> c.bar
42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment