Steven D'Aprano added the comment:
Is this unnecessary code churn?
That's not a rhetorical question. Fixing code that isn't broken is not always a
good idea.
``func(<list comprehension>)`` is not always identical to ``func(<generator
expression>)``, there are situations where there is a significant performance
difference between the two. E.g. str.join() is significantly faster when passed
a list than when passed a generator expression. According to my tests:
''.join(['abc' for x in range(1000000)])
is about 40% faster than
''.join('abc' for x in range(1000000))
----------
nosy: +steven.daprano
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue30296>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com