Oct-09-2017, 10:42 PM
As a note about miltmobley's comments:
I strongly recommend using the append() method instead of
List comprehensions can be faster, but "efficient" often has a technical meaning (complexity analysis, big-O), so just be aware of potential pushback from that wording.
I strongly recommend using the append() method instead of
+=
. The latter requires creating many intermediate lists, which is unnecessary.List comprehensions can be faster, but "efficient" often has a technical meaning (complexity analysis, big-O), so just be aware of potential pushback from that wording.