Serhiy Storchaka added the comment: > This looks nicer and should run faster by taking advantage of the LIST_APPEND > opcode.
The difference is insignificantly (less than 1%) for large lists (list(range(10000))), but it is 3-4% slower for small lists (list(range(10))) and 20-25% slower for empty lists. On 2.7 your code always has advantage, but on 3.x seems it doesn't have any advantage (thanks to overhead of using a generator). ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26167> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com