Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><a href="http://docs.python.org/2/tutorial/datastructures.html#tuples-and-sequences" rel="noreferrer">Tuples</a> are fixed size in nature whereas <a href="http://docs.python.org/2/tutorial/introduction.html#lists" rel="noreferrer">lists</a> are dynamic.<br> In other words, a <code>tuple</code> is <strong>immutable</strong> whereas a <code>list</code> is <strong>mutable</strong>.</p> <ol> <li>You can't add elements to a tuple. Tuples have no append or extend method.</li> <li>You can't remove elements from a tuple. Tuples have no remove or pop method.</li> <li>You can find elements in a tuple, since this doesn’t change the tuple. </li> <li>You can also use the <code>in</code> operator to check if an element exists in the tuple.</li> </ol> <hr> <ul> <li><p><strong>Tuples are faster than lists.</strong> If you're defining a constant set of values and all you're ever going to do with it is iterate through it, use a tuple instead of a list.</p></li> <li><p>It makes your code safer if you “write-protect” data that does not need to be changed. Using a tuple instead of a list is like having an implied assert statement that this data is constant, and that special thought (and a specific function) is required to override that.</p></li> <li><p>Some tuples can be used as dictionary keys (specifically, tuples that contain immutable values like strings, numbers, and other tuples). Lists can never be used as dictionary keys, because lists are not immutable. </p></li> </ul> <p>Source: <a href="http://getpython3.com/diveintopython3/native-datatypes.html#tuples" rel="noreferrer">Dive into Python 3</a> </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload