Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 106bdd3

Browse files
committed
Correct __repr__: include module name, avoid extra space for empty status,
use 0x format for id. Proposed by Cesar Eduardo Barros in patch #470680.
1 parent 9abaf4d commit 106bdd3

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

Lib/asyncore.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ def __init__ (self, sock=None, map=None):
209209

210210
def __repr__ (self):
211211
try:
212-
status = []
212+
status = [self.__class__.__module__+"."+self.__class__.__name__]
213213
if self.accepting and self.addr:
214214
status.append ('listening')
215215
elif self.connected:
@@ -219,8 +219,7 @@ def __repr__ (self):
219219
status.append ('%s:%d' % self.addr)
220220
else:
221221
status.append (self.addr)
222-
return '<%s %s at %x>' % (self.__class__.__name__,
223-
' '.join (status), id (self))
222+
return '<%s at %#x>' % (' '.join (status), id (self))
224223
except:
225224
pass
226225

0 commit comments

Comments
 (0)