Please provide a better explanation of tuples and dictionaries

Chris Angelico rosuav at gmail.com
Wed Jan 30 01:25:51 EST 2013


On Wed, Jan 30, 2013 at 5:14 PM, Daniel W. Rouse Jr.
<dwrousejr at nethere.comnospam> wrote:
> To me, this looks like an array. Is tuple just the Python name for an array?

Not quite. An array is closer to a Python list - a tuple can be
thought of as a "frozen list", if you like. Lists can be added to,
removed from, and changed in many ways; tuples are what they are, and
there's no changing them (the objects inside it could be changed, but
WHAT objects are in it won't).

Python has no strict match to a C-style array with a fixed size and
changeable members; a Python list is closest to a C++ std::vector, if
that helps at all.

ChrisA



More information about the Python-list mailing list