2014-01-03 22:53:18 +00:00
|
|
|
# list poppin'
|
|
|
|
a = [1, 2, 3]
|
|
|
|
print(a.pop())
|
|
|
|
print(a.pop())
|
|
|
|
print(a.pop())
|
|
|
|
try:
|
|
|
|
print(a.pop())
|
|
|
|
except IndexError:
|
|
|
|
print("IndexError raised")
|
|
|
|
else:
|
|
|
|
raise AssertionError("No IndexError raised")
|
2016-08-15 01:46:35 +01:00
|
|
|
|
|
|
|
# popping such that list storage shrinks (tests implementation detail of uPy)
|
|
|
|
l = list(range(20))
|
|
|
|
for i in range(len(l)):
|
|
|
|
l.pop()
|
|
|
|
print(l)
|