If you look at the second part of the code, you see that the assignment that is happening is
parts = s.split()
print id(parts) # 3074380332
In the above, parts is expected to be a list, since it is the output of .split. It would thus be logical, to instantiate it with a value of the same kind, like parts = [], for maintaining coherence of the program.
Imagine a scenario, where the second part fails (example code), and you still want to do something with parts. If you instantiate this with any other value, your code becomes inconsistent logically, and may throw errors. If you did parts = 0 below, it simply would've failed since then parts would not have been an iterable, and so on:
parts = [] # works
# parts = 0 # doesn't work
try:
s = 0
parts = s.split()
except:
pass
for part in parts:
print part
parts = []is better thanparts = 0. It shows thatpartsis a list, even if it's the redefined later as a different list. Usingparts = 0first would just add extra confusion as the type would be changed.finallyroutinepartsis always defined and is always a 'right' type. In your code snippet - it does not make any sense.