Message265883
| Author |
ppperry |
| Recipients |
Winterflower, matrixise, ppperry, rhettinger, terry.reedy |
| Date |
2016年05月19日.19:09:37 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1463684977.52.0.506376563289.issue25548@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
I don't quite get why the memory address is helpful, but you could work around this using a custom metaclass:
class IdMeta(type):
def __repr__(cls):
return super().__repr__()[:-1] + " at 0x%x>"%id(cls)
class IdInRepr(metaclass=IdMeta):pass
`IdInRepr` and all its subclasses will then have the memory address in their representation:
<class 'module.name' at address> |
|