array and list

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Fri Jan 18 04:48:21 EST 2008


J. Peng>why perl call it array and python call it list?<

Unfortunate naming, I'd say. Calling list a dynamic array is silly,
despite all the things you may say about abstract data types having
the correct methods, etc.


Paddy:
> 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,....

Both Python "array.array" and "list" are implemented as dyn arrays,
not as lists. Only the good "deque" by Hettinger is something similar
to a list (of small arrays).

Bye,
bearophile



More information about the Python-list mailing list