Commit 73592a00 authored by Chris Withers's avatar Chris Withers

Added useful 'total' attribute to batches.

parent 8215b816
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
############################################################################## ##############################################################################
__doc__='''Batch class, for iterating over a sequence in batches __doc__='''Batch class, for iterating over a sequence in batches
$Id: Batch.py,v 1.7 2002/02/15 16:26:56 evan Exp $''' $Id: Batch.py,v 1.8 2002/03/15 16:01:52 chrisw Exp $'''
__version__='$Revision: 1.7 $'[11:-2] __version__='$Revision: 1.8 $'[11:-2]
from ExtensionClass import Base from ExtensionClass import Base
...@@ -53,6 +53,8 @@ class Batch(Base): ...@@ -53,6 +53,8 @@ class Batch(Base):
argument, is a 1-based index (I know, lame). "first" is the argument, is a 1-based index (I know, lame). "first" is the
0-based index. "length" is the actual number of elements in 0-based index. "length" is the actual number of elements in
the batch. the batch.
"total" is the length of the original, unbatched, sequence
''' '''
start = start + 1 start = start + 1
...@@ -68,6 +70,7 @@ class Batch(Base): ...@@ -68,6 +70,7 @@ class Batch(Base):
self.overlap = overlap self.overlap = overlap
self.first = max(start - 1, 0) self.first = max(start - 1, 0)
self.length = self.end - self.first self.length = self.end - self.first
self.total = len(sequence)
if self.first == 0: if self.first == 0:
self.previous = None self.previous = None
......
...@@ -4,6 +4,12 @@ ZTUtils changes ...@@ -4,6 +4,12 @@ ZTUtils changes
Change information for previous versions can be found in the Change information for previous versions can be found in the
file HISTORY.txt. file HISTORY.txt.
After Version 1.1.3
Features Added
- Added useful 'total' attribute to batches.
Version 1.1.4 Version 1.1.4
Features Added Features Added
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment