[issue4543] container constructors destroy argument

Raymond Hettinger report at bugs.python.org
Fri Dec 5 09:00:18 CET 2008


Raymond Hettinger <rhettinger at users.sourceforge.net> added the comment:

In Py3.0, the filter() builtin returns a consumable iterator, not a list.
It's a feature, not a bug ;-)
For the behavior you want, write:
   y = list(filter(odd, x))
Or better yet, use a list comprehension:
   y = [e for e in x if odd(e)]
See the Whatsnew section of the docs for further explanation.

----------
nosy: +rhettinger
resolution:  -> invalid
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4543>
_______________________________________


More information about the Python-bugs-list mailing list