array and list
jpeng at block.duxieweb.com
Fri Jan 18 09:18:30 CET 2008
> On Jan 18, 3:23 am, "J. Peng" <peng.... at gmail.com> wrote:
>> what's the difference between an array and a list in python?
>> I see list has all features of array in C or perl.
>> so please tell me.thanks.
> If you are new to Python, then where other languages may reach for an
> 'array', Python programs might organise data as lists. Lists are used
> much more than arrays in Python. you should find that is the case in
> tutorials/books too.
> - Paddy.
From Core Python Programming book (btw I like this book) I know the
difference is that array can hold only one type (the C standard?), but
list can hold every type of object. But hmm, perl's array also can hold
every type of variables, why perl call it array and python call it list?
Also, if I understand it correctly, python's tuple is called as 'list'
in perl, so I'm somewhat confused about them.
> P.S. if you know Perl then try:
Yes I know some Perl. I have registered module on CPAN.
More information about the Python-list