
April 2, 2020
4 p.m.
On Fri, Apr 03, 2020 at 12:28:36AM +0400, Abdur-Rahmaan Janhangeer wrote:
This means we have a __repr__ option in packages (Without Steven's snippet above)?
There is no "hook" in the package file structure where you can customize the repr. It is built into the module type. Once loaded, packages are just a module object like any other module. If you want to change the repr() of modules, you will need to change the built-in ModuleType class. But I can tell you that this will 99.999999% be rejected. And if it is accepted, I can tell you that the first time you get hit by a massive wall of text from a package docstring in an exception or some other use of repr(), you will likely regret the change. -- Steven