Alejandro Gonzalez <alejandro...@gmail.com> added the comment:
>I think we can proceed with option A, but only if doesn't cause visible >slow-down for creating ABCs (which is already slower that normal classes). >TBH, I don't want to document A as "official" recipe (maybe however mention >the problem in the `pickle` module docs). I'll try using the same approach used in namedtuple, and see if there is any visible slow-down. Regarding the documentation, I see your point. Perhaps adding some section like "Notes on pickling dynamically-defined classes" in the `pickle` module would be more appropriate? That section would mention that you have to make sure to set the `__module__` attribute. >Note that other "class factories" in stdlib (like collections.namedtuple) do >almost exactly option A. Thanks for the tip. Indeed it does. In fact, the API defines a module argument. Its documentation could be improved, though. It should mention why would you want to pass that argument (pickling seems to be the reason that argument was added in the first place). ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue28869> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com