From 9c9a7bfcb2e4e77ed744e427505ad84f26a3ec98 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sat, 21 Jul 2012 08:48:00 -0400 Subject: [PATCH] Python 3 scraps the iter(...).next() method, so use next(iter(...)). --- igor/struct.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/igor/struct.py b/igor/struct.py index 0d0837e..4887a14 100644 --- a/igor/struct.py +++ b/igor/struct.py @@ -252,11 +252,11 @@ class Field (object): _LOG.debug('unpack {} for {} {}'.format(data, self, self.format)) iterator = iter(data) try: - items = [iterator.next() for i in range(self.arg_count)] + items = [next(iterator) for i in range(self.arg_count)] except StopIteration: raise ValueError('not enough data to unpack {}'.format(self)) try: - iterator.next() + next(iterator) except StopIteration: pass else: @@ -549,13 +549,13 @@ class Structure (_struct.Struct): iterator = iter(args) for f in self.fields: try: - items = [iterator.next() for i in range(f.arg_count)] + items = [next(iterator) for i in range(f.arg_count)] except StopIteration: raise ValueError('not enough data to unpack {}.{}'.format( self, f)) data[f.name] = f.unpack_data(items) try: - iterator.next() + next(iterator) except StopIteration: pass else: @@ -671,7 +671,7 @@ class DynamicStructure (Structure): ... ], ... byte_order='>') - >>> b = '\x00\x00\x00\x02\x01\x02\x03\x04' + >>> b = b'\x00\x00\x00\x02\x01\x02\x03\x04' >>> d = dynamic_length_vector.unpack(b) >>> pprint(d) {'data': array([258, 772]), 'length': 2} -- 2.26.2