[Python-Dev] The `for y in [x]` idiom in comprehensions
Nick Coghlan
ncoghlan at gmail.com
Sat Feb 24 01:08:35 EST 2018
More information about the Python-Dev mailing list
Sat Feb 24 01:08:35 EST 2018
- Previous message (by thread): [Python-Dev] The `for y in [x]` idiom in comprehensions
- Next message (by thread): [Python-Dev] The `for y in [x]` idiom in comprehensions
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 24 February 2018 at 06:50, Stefan Behnel <stefan_ml at behnel.de> wrote: > But in general, yes, changing a list iterable into a tuple is an > improvement as tuples are more efficient to allocate. Haven't tried it in > CPython (*), but it might make a slight difference for very short > iterables, which are probably common. CPython has included the list->tuple conversion for lists of literals for quite some time, and Serhiy just posted a patch to extend that to all inline lists where it's a safe change to make: https://bugs.python.org/issue32925 Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20180224/76a8d650/attachment.html>
- Previous message (by thread): [Python-Dev] The `for y in [x]` idiom in comprehensions
- Next message (by thread): [Python-Dev] The `for y in [x]` idiom in comprehensions
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list