Message380315
First, here's an example using str():
```
class NiceObject:
def __str__(self):
return str(self.__dict__)
def __repr__(self):
return str(self)
s = NiceObject()
s.self = s
```
This outputs:
```
>>> s
{'self': {...}}
```
When I replace str() call with pprint.saferepr(), I end up in infinite recursion.
```
import pprint
class ReallyNiceObject:
def __str__(self):
return pprint.saferepr(self.__dict__)
def __repr__(self):
return str(self)
```
Same happens for pprint.pformat(), with depth set.
Is this expected behavior? |
|
Date |
User |
Action |
Args |
2020-11-04 11:44:31 | danbst | set | recipients:
+ danbst |
2020-11-04 11:44:31 | danbst | set | messageid: <1604490271.59.0.652277780579.issue42259@roundup.psfhosted.org> |
2020-11-04 11:44:31 | danbst | link | issue42259 messages |
2020-11-04 11:44:31 | danbst | create | |
|