24 | | That asked, are there more iterable builtins than list, tuple, str/bytes and dict? I guess it is safer to just explicitly test for list and tuple. |
| 24 | That asked, are there more iterable builtins than list, tuple, str/bytes and dict? I guess it is safer to just explicitly test for list and tuple. EDIT Like this: |
| 25 | {{{ |
| 26 | #!python |
| 27 | if isinstance(G, dict): |
| 28 | return dict((pickle_gap_data(k), pickle_gap_data(v)) for k,v in G.items()) |
| 29 | if isinstance(G, (list, tuple)]: |
| 30 | return type(G)(pickle_gap_data(X) for X in G) |
| 31 | return G |
| 32 | }}} |