Last active
January 13, 2016 05:44
-
-
Save masasuzu/c7082b003170155d829e to your computer and use it in GitHub Desktop.
文字列表現として、インスタンス変数をダンプしたい
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
class Hoge(object): | |
def __init__(self, foo=[], bar={ 'name': 'piyo' }): | |
self.foo = foo | |
self.bar = bar | |
def __repr__(self): | |
return '%s: %s' % (self.__class__, self.__dict__) | |
hoge = Hoge() | |
print(hoge) |
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
<class '__main__.Hoge'>: {'foo': [], 'bar': {'name': 'piyo'}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment