Created
June 7, 2016 02:27
-
-
Save makmanalp/34c8762109aa8ec991aaa786ee4bb8ff to your computer and use it in GitHub Desktop.
Code in the body of a class - 12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [1]: class Foo(object): | |
...: for i in range(3): | |
...: setattr(Foo, "x"+str(i), i) | |
...: | |
--------------------------------------------------------------------------- | |
NameError Traceback (most recent call last) | |
<ipython-input-1-bcc534efdfb8> in <module>() | |
----> 1 class Foo(object): | |
2 for i in range(3): | |
3 setattr(Foo, "x"+str(i), i) | |
4 | |
<ipython-input-1-bcc534efdfb8> in Foo() | |
1 class Foo(object): | |
2 for i in range(3): | |
----> 3 setattr(Foo, "x"+str(i), i) | |
4 | |
NameError: name 'Foo' is not defined |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment