Created
June 6, 2016 04:25
-
-
Save makmanalp/47f8f161f704285f88746f2ae3960ec7 to your computer and use it in GitHub Desktop.
Code in the body of a class - 8
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 [83]: class Foo(object): | |
for i in range(3): | |
setattr(Foo, "x"+str(i), i) | |
....: | |
In [84]: Foo.x0 | |
--------------------------------------------------------------------------- | |
AttributeError Traceback (most recent call last) | |
<ipython-input-84-e9bd27bad8bd> in <module>() | |
----> 1 Foo.x0 | |
AttributeError: type object 'Foo' has no attribute 'x0' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment