array and list

Paddy paddy3118 at googlemail.com
Fri Jan 18 04:21:57 EST 2008


On Jan 18, 8:18 am, "J. Peng" <jp... at block.duxieweb.com> wrote:
> > 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.
>
> >http://wiki.python.org/moin/PerlPhrasebook?highlight=%28perl%29
>
> > - Paddy.
>
> Hi,
>
>  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?

Similar ideas, different names. It happens. I guess 'under the hood'
Python
(& Perl?), arrays might be more like an implementation of what the C
programmer might call a linked list, but even then there are
differences as
most linked list examples given in C tutorials are lists of the same
type of
object,....

- Paddy.

> 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.
>
> thanks!




More information about the Python-list mailing list