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.
Created on 2008年08月26日 20:17 by laxrulz777, last changed 2022年04月11日 14:56 by admin. This issue is now closed.
| Messages (4) | |||
|---|---|---|---|
| msg71993 - (view) | Author: Jeff Hall (laxrulz777) | Date: 2008年08月26日 20:17 | |
reversed() built in is not functioning correctly with list (specifically with len() ) l = [1,2,3,4] rl = reversed(l) type(rl) <type 'listreverseiterator'> vs. strings and tuples which just return 'reverse' objects listreverseiterators apparently have a len() defined that changes with each .next() call |
|||
| msg71994 - (view) | Author: Georg Brandl (georg.brandl) * (Python committer) | Date: 2008年08月26日 20:27 | |
"reversed() built in is not functioning correctly with list" is wrong -- there is no problem with reversed() on lists. The issue here is that the listreverseiterator has a strange __len__. Note that other (reverse) iterators have no __len__ at all, so apart from consistency there is nothing that "does not function correctly." |
|||
| msg71995 - (view) | Author: Armin Ronacher (aronacher) * (Python committer) | Date: 2008年08月26日 20:42 | |
Just for the record. This original discussion for this bug is here: http://article.gmane.org/gmane.comp.python.devel/96925 |
|||
| msg76787 - (view) | Author: Raymond Hettinger (rhettinger) * (Python committer) | Date: 2008年12月02日 21:34 | |
Fixed r67478. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:56:38 | admin | set | github: 47939 |
| 2008年12月02日 21:34:18 | rhettinger | set | status: open -> closed resolution: fixed messages: + msg76787 |
| 2008年08月26日 20:42:56 | aronacher | set | nosy:
+ aronacher messages: + msg71995 |
| 2008年08月26日 20:31:48 | georg.brandl | set | assignee: rhettinger title: reversed() not working as intended on lists -> listreverseiterator has a decreasing len() nosy: + rhettinger versions: + Python 2.6, Python 3.0, - Python 2.5 |
| 2008年08月26日 20:27:24 | georg.brandl | set | priority: low nosy: + georg.brandl messages: + msg71994 |
| 2008年08月26日 20:17:14 | laxrulz777 | create | |