thanks a lot to all, i help me to learn a lot !
(i finally use the generator trick, it is great...)
best regards.
--
http://mail.python.org/mailman/listinfo/python-list
Hello,
i'm looking for this behaviour and i write a piece of code which works,
but it looks odd to me. can someone help me to refactor it ?
i would like to walk across a list of items by series of N (N=3 below)
of these. i had explicit mark of end of a sequence (here it is '.')
which may be any
Michael Spencer a écrit :
If you just need to 'walk across a list of items', then your buffer class and
helper function seem unnecessary complex. A generator would do the trick,
something like:
actually for the example i have used only one sentry condition by they
are more numerous and
Here is another version,
class ChunkeredBuffer:
def __init__(self):
self.buffer = []
self.sentries = []
def append(self, item):
self.buffer.append(item)
def chunk(self, chunkSize, keepFirst = False):
self.sentries.append(len(self.buffer))
oops
to have:
this .
this . is a .
this . is a . test to .
is a . test to . check if it .
test to . check if it . works .
check if it . works . well .
works . well . it looks like .
well . it looks like .
it looks like .
--
http://mail.python.org/mailman/listinfo/python-list