projects
/
quizzer.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
323414c
)
question: Add Question.__str__() and __repr__()
author
W. Trevor King
<wking@tremily.us>
Tue, 5 Feb 2013 15:27:16 +0000
(10:27 -0500)
committer
W. Trevor King
<wking@tremily.us>
Tue, 5 Feb 2013 15:27:16 +0000
(10:27 -0500)
For easily viewing questions in lists.
quizzer/question.py
patch
|
blob
|
history
diff --git
a/quizzer/question.py
b/quizzer/question.py
index 065b17e86dbb80ad0438c0fe2172e6da3fa82b88..e423adf0da629d40b9e8feaef49931f54c5c1808 100644
(file)
--- a/
quizzer/question.py
+++ b/
quizzer/question.py
@@
-11,6
+11,13
@@
class Question (object):
dependencies = []
self.dependencies = dependencies
+ def __str__(self):
+ return '<{} id:{!r}>'.format(type(self).__name__, self.id)
+
+ def __repr__(self):
+ return '<{} id:{!r} at {:#x}>'.format(
+ type(self).__name__, self.id, id(self))
+
def __getstate__(self):
return {
'id': self.id,