sum(1 for x in islice(a, 0, 900000) if x == 0)
len(list(filter('\x00'.__eq__, islice(a, 0, 900000))))
a = bytearray('hello')
b = bytearray('goodbye, cruel world.')
a.extend(islice(b, 14, 20))
a
Avoiding unnecessary slice copying in Python