r...@zedat.fu-berlin.de (Stefan Ram) writes:
>Then you can use pickle or custom methods to save and
>restore the object, or get the state from an iterator
>and create a new iterator with that state later.

  One does not always have to write a custom class,
  for example:

  main.py

import pickle
r = range( 9 )
i = iter( r )
del r
next( i )
next( i )
next( i )
bytes = pickle.dumps( i )
del i
i = pickle.loads( bytes )
print( next( i ))
del i
del pickle

  transcript

3

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to