First attempt at a Python prog (Chess)
steve+comp.lang.python at pearwood.info
Tue Feb 19 07:24:30 CET 2013
On Mon, 18 Feb 2013 20:15:28 -0800, Tim Roberts wrote:
> Chris Hinsley <chris.hinsley at gmail.com> wrote:
>>Is a Python list as fast as a bytearray ?
> Python does not actually have a native array type. Everything in your
> program that looked like an array was actually a list.
Actually it does, but you have to import it first, it is not a built-in
py> import array
py> arr = array.array('f') # array of floats (C singles)
array('f', [0.10000000149011612, 0.20000000298023224])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: a float is required
See the documentation for array to see the available type-codes.
As part of the standard library, Jython and IronPython are required to
implement arrays as well (although they don't use C arrays, so the
implementation may be different).
IronPython also gives you access to .Net arrays, although of course that
is not standard Python:
More information about the Python-list