property: add property.__str__

This commit is contained in:
Marek Marczykowski-Górecki 2017-05-19 18:42:03 +02:00
parent f7cb8f27c5
commit f9fa27dacc
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -294,8 +294,10 @@ class property(object): # pylint: disable=redefined-builtin,invalid-name
if self._default is not self._NO_DEFAULT \ if self._default is not self._NO_DEFAULT \
else '' else ''
return '<{} object at {:#x} name={!r}{}>'.format( return '<{} object at {:#x} name={!r}{}>'.format(
self.__class__.__name__, id(self), self.__name__, default) \ self.__class__.__name__, id(self), self.__name__, default)
def __str__(self):
return self.__name__
def __hash__(self): def __hash__(self):
return hash(self.__name__) return hash(self.__name__)