list.append()によって値を list に追加する代わりに、なぜこのように値を割り当てることができないのですか?
In [24]: def a():
....: a1=[5]
....: print a1[0]
....:
In [25]: a()
5
In [28]: def a():
....: a1=[5]
....: a1[1]=12
....: print a1[1]
....:
In [29]: a()
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
/home/dubizzle/webapps/django/dubizzle/<ipython-input-29-72f2e37b262f> in <module>()
----> 1 a()
/home/dubizzle/webapps/django/dubizzle/<ipython-input-28-681d86164e67> in a()
1 def a():
2 a1=[5]
----> 3 a1[1]=12
4 print a1[1]
5
IndexError: list assignment index out of range