Note: the brackets [] are unnecessary here and can be dropped -- this code would be more succinct (and possibly slightly faster) as a generator comprehension.