array and list
Steven D'Aprano
steve at REMOVE-THIS-cybersource.com.au
Thu Jan 17 23:36:35 EST 2008
On Fri, 18 Jan 2008 15:05:23 +1100, Ben Finney wrote:
> "J. Peng" <peng.kyo at gmail.com> writes:
>
>> what's the difference between an array and a list in python?
>
> In Python, 'list' is a basic built-in type. Python has no 'array' type,
> though that term is often used to refer to the 'array' type defined in
> Numeric Python (which is not part of the standard library, so not really
> part of Python).
Did you forget the array module?
>>> import array
>>> array
<module 'array' from '/usr/lib/python2.5/lib-dynload/arraymodule.so'>
>> I see list has all features of array in C or perl.
>
> You may also want to compare and constrast Python 'list' and 'dict'.
The Original Poster might also like to check out the help() and dir()
functions in the interactive interpreter:
help(list)
dir(list)
help(array)
help(array.array)
etc.
--
Steven
More information about the Python-list
mailing list