2

Dill module is awesome, it can pickle the entire python interpretor global state. But Dill cannot pickle generators. I know it is not supported. But i would like to know the technical reason given that it can pickle python functions?

AravindR
  • 677
  • 4
  • 11
  • 1
    I'm not sure there is a technical reason; from the web page, "Dill cannot yet pickle these standard types: - frame, generator, traceback" implies they just haven't supported it yet. Maybe there is a technical reason that makes it tricky to do so. – chepner Feb 21 '16 at 19:45
  • I am curious why it is tricky? given that dill can pickle stateful functions and objects. – AravindR Feb 21 '16 at 20:24
  • I have no idea; I'm just assuming that's the case if it's one of the last things they *don't* support yet. – chepner Feb 21 '16 at 20:53

1 Answers1

2

This is covered in dill's issue tracker, issue #10 (pickle iterators), which says that it's not easily done--for reference it points both to an existing Stack Overflow answer and to Python's issue tracker, particularly to an enhancement request titled Make Generators Pickle-able, which was rejected.

Community
  • 1
  • 1
mech
  • 2,775
  • 5
  • 30
  • 38
  • 1
    Thx for the answer. Bummer though. – AravindR Feb 26 '16 at 07:21
  • Yeah. At least they didn't close the door completely, it's just not a priority (and they want someone to come up with a *good* implementation before they'll consider it)... So who knows, maybe it'll happen someday :) – mech Feb 26 '16 at 07:23