Would it be crazy to change #Python 's default repr?

Here's an example:

>>> f
<__main__.Foo object at 0x10367fca0>

The hex is the address of the Python object, and on CPython the same as id(f)

For the 99.999% case, it is useless information, and can only confuse novices.

@willmcgugan would be great if one could still look at two objects and know whether they're the same or different objects. Custom repr typically shows enough information to at least know whether they represent equivalent information, but how would a default repr ensure that?

Follow

@JakubKuczys @willmcgugan Yeah, I'm pretty sure that is why the repr includes the id information. It is *infuriating* to spend a bunch of time debugging what you think is two of the same object only to find out later they don't even compare equal or something.

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.