Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #37925

Re: Please provide a better explanation of tuples and dictionaries

References <hKCdnWgrOqkwFpXMnZ2dnUVZ_qadnZ2d@o1.com> <keaa9v$1ru$1@reader1.panix.com> <xZGdnaPMi5fuJ5XMnZ2dnUVZ_rCdnZ2d@o1.com>
Date 2013-01-30 17:25 +1100
Subject Re: Please provide a better explanation of tuples and dictionaries
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.1204.1359527154.2939.python-list@python.org> (permalink)

Show all headers | View raw


On Wed, Jan 30, 2013 at 5:14 PM, Daniel W. Rouse Jr.
<dwrousejr@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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Please provide a better explanation of tuples and dictionaries "Daniel W. Rouse Jr." <dwrousejr@nethere.comNOSPAM> - 2013-01-29 18:55 -0800
  Re: Please provide a better explanation of tuples and dictionaries Chris Angelico <rosuav@gmail.com> - 2013-01-30 14:11 +1100
    Re: Please provide a better explanation of tuples and dictionaries "Daniel W. Rouse Jr." <dwrousejr@nethere.comNOSPAM> - 2013-01-29 19:42 -0800
      Re: Please provide a better explanation of tuples and dictionaries Chris Angelico <rosuav@gmail.com> - 2013-01-30 14:51 +1100
  Re: Please provide a better explanation of tuples and dictionaries Mitya Sirenef <msirenef@lightbird.net> - 2013-01-29 22:51 -0500
  Re: Please provide a better explanation of tuples and dictionaries John Gordon <gordon@panix.com> - 2013-01-30 05:15 +0000
    Re: Please provide a better explanation of tuples and dictionaries "Daniel W. Rouse Jr." <dwrousejr@nethere.comNOSPAM> - 2013-01-29 22:14 -0800
      Re: Please provide a better explanation of tuples and dictionaries Chris Angelico <rosuav@gmail.com> - 2013-01-30 17:25 +1100
      Re: Please provide a better explanation of tuples and dictionaries Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-30 07:12 +0000
  Re: Please provide a better explanation of tuples and dictionaries rusi <rustompmody@gmail.com> - 2013-01-30 00:14 -0800
  Re: Please provide a better explanation of tuples and dictionaries Rick Johnson <rantingrickjohnson@gmail.com> - 2013-02-02 21:20 -0800
    Re: Please provide a better explanation of tuples and dictionaries Michael Torrie <torriem@gmail.com> - 2013-02-03 00:14 -0700
    Re: Please provide a better explanation of tuples and dictionaries Chris Angelico <rosuav@gmail.com> - 2013-02-03 18:21 +1100

csiph-web