because .append
method returns None
, therefore not None
evaluates to True
. Python on error usually raises an error:
>>> a = ()
>>> a.append(5)
Traceback (most recent call last):
File "", line 1, in
a.append(5)
AttributeError: 'tuple' object has no attribute 'append'