Why can't generators be pickled?
Why can't generators be pickled? Question: Python’s pickle (I’m talking standard Python 2.5/2.6/2.7 here) cannot pickle locks, file objects etc. It also cannot pickle generators and lambda expressions (or any other anonymous code), because the pickle really only stores name references. In case of locks and OS-dependent features, the reason why you cannot pickle them …