Serhiy Storchaka added the comment:

* Some functions that accept an arbitrary iterable first convert it to 
temporary list and iterate that list. In these cases there is no significant 
difference in memory usage between list comprehension and generator, but the 
variant with list comprehension is slightly faster.

* foo(bar(x) for x in a) can be written also as foo(map(bar, a)). Both 
expressions are idiomatic, different users have different preferences, the 
variant with map can be faster for larger loops. The variant with map can even 
be faster than comprehensions.

* Proposed patch changes some files which should be kept compatible with old 
Python versions. Old Python versions can not support set and dict 
comprehensions.

* In general we avoid making changes to many files that doesn't have obvious 
positive effect. Most changes doesn't have measurable effect, they are just 
style changes. But different users have different preferences and existing code 
is not obviously bad.

Assigned to Raymond because it usually opposed to such kind of changes but made 
very similar changes in issue22823.

----------
assignee:  -> rhettinger
nosy: +rhettinger, serhiy.storchaka

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30296>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to