List comprehension
## This is the same as
arr = ['test ', 'this', ' thing ']
[x.trim() for x in arr]
## This
vals = []
for x in arr
vals.append(x.trim())
return vals
## This is the same as
[int(t) if t.isdigit() else t for t in re.split(r'(\d+)', key)]
## This
if t.isDigit():
return [int(t)]
else:
vals = []
for t in re.split(r'(\d+)', key)
vals.append(t)
return vals