mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
Issue #22033: Reprs of most Python implemened classes now contain actual
class name instead of hardcoded one.
This commit is contained in:
parent
54701f303f
commit
465e60e654
24 changed files with 102 additions and 74 deletions
|
@ -174,7 +174,7 @@ class Element:
|
|||
self._children = []
|
||||
|
||||
def __repr__(self):
|
||||
return "<Element %s at 0x%x>" % (repr(self.tag), id(self))
|
||||
return "<%s %r at %#x>" % (self.__class__.__name__, self.tag, id(self))
|
||||
|
||||
def makeelement(self, tag, attrib):
|
||||
"""Create a new element with the same type.
|
||||
|
@ -509,7 +509,7 @@ class QName:
|
|||
def __str__(self):
|
||||
return self.text
|
||||
def __repr__(self):
|
||||
return '<QName %r>' % (self.text,)
|
||||
return '<%s %r>' % (self.__class__.__name__, self.text)
|
||||
def __hash__(self):
|
||||
return hash(self.text)
|
||||
def __le__(self, other):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue