mirror of
https://github.com/faucetsdn/ryu.git
synced 2026-05-05 12:26:11 +02:00
stringify.StringifyMixin.__str__: simplify
simplify the code a bit. suggested by Isaku Yamahata. no functional changes are intended. Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
ffc1e60df4
commit
f3e70d440b
@ -53,13 +53,10 @@ class StringifyMixin(object):
|
||||
return obj_python_attrs(self)
|
||||
|
||||
def __str__(self):
|
||||
buf = ''
|
||||
sep = ''
|
||||
for k, v in self.stringify_attrs():
|
||||
buf += sep
|
||||
buf += "%s=%s" % (k, repr(v)) # repr() to escape binaries
|
||||
sep = ','
|
||||
return self.__class__.__name__ + '(' + buf + ')'
|
||||
# repr() to escape binaries
|
||||
return self.__class__.__name__ + '(' + \
|
||||
','.join("%s=%s" % (k, repr(v)) for k, v in
|
||||
self.stringify_attrs()) + ')'
|
||||
__repr__ = __str__ # note: str(list) uses __repr__ for elements
|
||||
|
||||
@classmethod
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user