Created
January 8, 2012 19:41
-
-
Save aodag/1579425 to your computer and use it in GitHub Desktop.
pythonの組み込み型に見られる特徴
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
>>> a.__dict__ | |
Traceback (most recent call last): | |
File "<stdin>", line 1, in <module> | |
AttributeError: 'int' object has no attribute '__dict__' | |
>>> a = 10 | |
>>> a.__dict__ | |
Traceback (most recent call last): | |
File "<stdin>", line 1, in <module> | |
AttributeError: 'int' object has no attribute '__dict__' | |
>>> a = 1.0 | |
>>> a.__dict__ | |
Traceback (most recent call last): | |
File "<stdin>", line 1, in <module> | |
AttributeError: 'float' object has no attribute '__dict__' | |
>>> a = "a" | |
>>> a.__dict__ | |
Traceback (most recent call last): | |
File "<stdin>", line 1, in <module> | |
AttributeError: 'str' object has no attribute '__dict__' | |
>>> a = True | |
>>> a.__dict__ | |
Traceback (most recent call last): | |
File "<stdin>", line 1, in <module> | |
AttributeError: 'bool' object has no attribute '__dict__' | |
>>> class A(object): | |
... pass | |
... | |
>>> a = A() | |
>>> a.__dict__ | |
{} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment