A list comprehension or a map call would probably be the same as these few lines.