3 ms·
Interesting read! I'm still missing what "B" in the Python code referring to as well.
by proyb2 10y ago
Interesting read! I'm still missing what "B" in the Python code referring to as well.
- tyingq 10y agoarray.array isn't a normal python array. It's an optimized type/object where all the elements of the array are of the same type. The 'B' is a format string that indicates what type you want the elements to be. B == unsigned char He's using it because it converts the int 65 to the string 'A', then toString() to join all the array elements together. https://docs.python.org/2/library/array.html https://docs.python.org/2/library/array.html See my other post though, it's not the fastest way to do this in python.
- proyb2 10y agoGreat thanks! I have assume array.array is similar to 2-dimensional array.
- tyingq 10y agoThe python timings are for 1000 iterations. You are currently comparing apple to 1000 apples :)
- scriptkiddy 10y ago`array.array` is more like a C array than a Python list.