News for hackers. Stuff that matters.
Re:Namedtuple in a Post-Dataclasses World by Spivak on Sunday July 25, 2021 @06:19PM (#27953469)
There’s a difference between the classes __qualname__ and the requirement that there be reference to the class at, say, __main__.$qualname as the way for pickle to actually find the class object.

This is the part that, to me, is really odd because pickle knows (in theory) the class and module name of the thing it needs to instantiate and the class objects themselves know their name and module.

Up to the lack efficiency actually doing this you could just enumerate all class objects to find the one with the right name and module name.

You get nested classes for free this way and you break the requirement that there be references to class objects of the same name in the module.

There are no comments on this comment yet.