Slide 85
Slide 85 text
Copyright (C) 2011, David Beazley, http://www.dabeaz.com
An Observation
85
• bytes and bytearray are not really meant to
mimic Python 2 string objects
• They're closer to array.array('B',...) objects
>>> import array
>>> s = array.array('B',[10,20,30,40,50])
>>> s[1]
20
>>> s[1] = 200
>>> s.append(100)
>>> s.extend([65,66,67])
>>> s
array('B', [10, 200, 30, 40, 50, 100, 65, 66, 67])
>>>