Package commons :: Module seqs :: Class PersistentSeq
[hide private]
[frames] | no frames]

Class PersistentSeq

source code

           object --+    
                    |    
PersistentConsumedSeq --+
                        |
                       PersistentSeq

I generate [0, 1, ...], like count, but I can also save my state to disk. I save my state immediately to disk on each call to next.

Instance Methods [hide private]
 
__init__(self, path)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
int
next(self)
Generates the next number in the sequence and immediately commits it.
source code

Inherited from PersistentConsumedSeq: close, commit

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Instance Variables [hide private]

Inherited from PersistentConsumedSeq: seqno

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, path)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Parameters:
  • path (str) - File to save my state in. I keep this file open.
Overrides: object.__init__

next(self)

source code 

Generates the next number in the sequence and immediately commits it.

Returns: int
The next number in the sequence.
Raises:
Overrides: PersistentConsumedSeq.next