Python > Tuples versus Lists


参考1

@ Introducing Python: Modern Computing in Simple Packages by Bill Lubanovic
(No. 1466 / 12833)

..., but they have many fewer functions -- there is no append(), insert(), and so on -- because they can't be modified after creation.

listと比べてtupleを使う理由が記載されている。

  • Tuples use less space.
  • You can't clobber tuple items by mistake.
  • You can use tuples as dictionary keys
  • Named tuples can be a simple alternative to objects.
  • Function arguments are passed as tuples.

Named tuplesの例は以下。
http://stackoverflow.com/questions/2970608/what-are-named-tuples-in-python

Function argumentsへのtuples渡しは別途。

参考2

tupleとlistの違いについて
http://stackoverflow.com/questions/626759/whats-the-difference-between-lists-and-tuples

Tuples have structure, lists have order.

など。