-
-
Notifications
You must be signed in to change notification settings - Fork 673
Closed
Description
Currently pickling doesn't work for finite word defined by iterator and callable :
sage: w = Word(iter('abcdefghijkl'))
sage: loads(dumps(w))
Traceback (most recent call last):
...
PicklingError: Can't pickle <type 'generator'>: attribute lookup __builtin__.generator failed
This is not too hard to support. One just have to expand the iterator to a list (or a tuple?) and save the list instead:
sage: w = Word(iter('abcdefghijkl'))
sage: loads(dumps(w))
word: abcdefghijkl
sage: type(_)
<class 'sage.combinat.words.word.FiniteWord_list'>
This is more general solution to the problem solved in #7519.
CC: @saliola
Component: combinatorics
Keywords: words
Author: Sébastien Labbé
Reviewer: Franco Saliola
Merged: sage-4.3.4.alpha0
Issue created by migration from https://trac.sagemath.org/ticket/7619