This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients eric.smith, miss-islington, paul.moore, rhettinger, sreedevi.ha, steven.daprano, terry.reedy
Date 2020-09-29.16:18:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> If space is not an issue, the list comprehension may be fastest.

I think there is still a misunderstanding here.  The generator variant does not save space.  It uses slightly *more* space than the list variant.

The list_ass_slice()¹ function runs PySequence_Fast² on its input.  If the input is already a list or tuple, it is returned immediately.  If not, the iterator is run to exhaustion and a new list is built.  Either way, when the actual update occurs, the source will be a list or tuple.

Date User Action Args
2020-09-29 16:18:21rhettingersetrecipients: + rhettinger, terry.reedy, paul.moore, eric.smith, steven.daprano, miss-islington, sreedevi.ha
2020-09-29 16:18:21rhettingersetmessageid: <>
2020-09-29 16:18:21rhettingerlinkissue41774 messages
2020-09-29 16:18:20rhettingercreate