Message76977
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. |
|
Date |
User |
Action |
Args |
2008-12-05 08:00:18 | rhettinger | set | recipients:
+ rhettinger, kjwcode |
2008-12-05 08:00:18 | rhettinger | set | messageid: <1228464018.17.0.633376721838.issue4543@psf.upfronthosting.co.za> |
2008-12-05 08:00:17 | rhettinger | link | issue4543 messages |
2008-12-05 08:00:16 | rhettinger | create | |
|