import struct
import p2pool
+from p2pool.util import memoize
class EarlyEnd(Exception):
pass
def read(self, file):
length, file = self._inner_size.read(file)
- res = []
+ res = [None]*length
for i in xrange(length):
- item, file = self.type.read(file)
- res.append(item)
+ res[i], file = self.type.read(file)
return res, file
def write(self, file, item):
def write(self, file, item):
return file, struct.pack(self.desc, item)
+@memoize.fast_memoize_multiple_args
class IntType(Type):
__slots__ = 'bytes step format_str max'.split(' ')