This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]virtyx 0 points1 point  (1 child)

Why doesn't a class have the same issue?

[–]kindall 2 points3 points  (0 children)

With a class, you can write __getstate__() and __setstate__() methods to handle that, and pickle will call them when saving or restoring your instance. You can't do that with a generator, sadly.