Correct __repr__: include module name, avoid extra space for empty status,

use 0x format for id. Proposed by Cesar Eduardo Barros in patch #470680.
This commit is contained in:
Martin v. Löwis 2001-10-12 22:39:20 +00:00
parent 9abaf4d3b7
commit 106bdd3b80
1 changed files with 2 additions and 3 deletions

View File

@ -209,7 +209,7 @@ class dispatcher:
def __repr__ (self):
try:
status = []
status = [self.__class__.__module__+"."+self.__class__.__name__]
if self.accepting and self.addr:
status.append ('listening')
elif self.connected:
@ -219,8 +219,7 @@ class dispatcher:
status.append ('%s:%d' % self.addr)
else:
status.append (self.addr)
return '<%s %s at %x>' % (self.__class__.__name__,
' '.join (status), id (self))
return '<%s at %#x>' % (' '.join (status), id (self))
except:
pass