回答編集履歴
2
追記
test
CHANGED
@@ -57,3 +57,17 @@
|
|
57
57
|
|
58
58
|
|
59
59
|
引用元: [Python チュートリアル » タプルとシーケンス](https://docs.python.jp/3/tutorial/datastructures.html#tuples-and-sequences)
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
参考
|
64
|
+
|
65
|
+
---
|
66
|
+
|
67
|
+
英語ですけれど、深まった議論がなされています。
|
68
|
+
|
69
|
+
[Stack Overflow - What's the difference between lists and tuples?](https://stackoverflow.com/questions/626759/whats-the-difference-between-lists-and-tuples)
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
> Apart from tuples being immutable there is also a semantic distinction that should guide their usage. Tuples are heterogeneous data structures (i.e., their entries have different meanings), while lists are homogeneous sequences. **Tuples have structure, lists have order.**
|
1
追記
test
CHANGED
@@ -49,3 +49,11 @@
|
|
49
49
|
|
50
50
|
|
51
51
|
リストは配列、タプルは構造体に近い使われ方をしているように思います。
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
> タプルはリストと似ていますが、たいてい異なる場面と異なる目的で利用されます。タプルは不変型 (immutable) で、複数の型の要素からなることもあり、要素はアンパック(この節の後半に出てきます)操作やインデックス (あるいは namedtuples の場合は属性)でアクセスすることが多いです。一方、リストは変更可能 (mutable) で、要素はたいてい同じ型のオブジェクトであり、たいていイテレートによってアクセスします。
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
引用元: [Python チュートリアル » タプルとシーケンス](https://docs.python.jp/3/tutorial/datastructures.html#tuples-and-sequences)
|