Message395468
> According to the documentation for types.SimpleNamespace, `repr(SimpleNamespace())`
> should return `"SimpleNamespace()"`, but in actuality returns `"namespace()"`.
Note that I purposefully wrote "roughly" in the docs ("The type is roughly equivalent to the following code:"). That code was meant to illustrate the functionality rather than be proscriptive of the implementation. That said, it certainly would be good for the documentation to match. :)
> but also the (perhaps less interesting issue) of `eval(repr(SimpleNamespace))` resulting in a NameError.
This is true of many of the types exposed by the types module (e.g. types.CodeType).
> I propose that `_PyNamespaceObject`'s __repr__ method be changed to return `"SimpleNamespace(<args>)"`.
My preference would be as outlined in my previous comment: make it a builtin. However, I'm not in a position to make that happen at the moment. |
|
Date |
User |
Action |
Args |
2021-06-09 20:42:43 | eric.snow | set | recipients:
+ eric.snow, ZackerySpytz, avrahami.ben |
2021-06-09 20:42:43 | eric.snow | set | messageid: <1623271363.02.0.424135161394.issue42088@roundup.psfhosted.org> |
2021-06-09 20:42:43 | eric.snow | link | issue42088 messages |
2021-06-09 20:42:42 | eric.snow | create | |
|