classification
Title: Dictionary iterator has no len()
Type: enhancement Stage: resolved
Components: Interpreter Core Versions: Python 3.6
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Add __len__ to map, everything in itertools
View: 24849
Assigned To: Nosy List: James.Lu, r.david.murray
Priority: normal Keywords:

Created on 2016-07-16 19:08 by James.Lu, last changed 2016-07-16 22:19 by r.david.murray. This issue is now closed.

Messages (5)
msg270581 - (view) Author: James Lu (James.Lu) * Date: 2016-07-16 19:08
This would be useful for libraries like tqdm (progress bar module).
msg270584 - (view) Author: James Lu (James.Lu) * Date: 2016-07-16 21:15
same for itertools iterators -  libraries such as tqdm would benefit from
this

On Sat, Jul 16, 2016 at 3:08 PM, James Lu <report@bugs.python.org> wrote:

>
> New submission from James Lu:
>
> This would be useful for libraries like tqdm (progress bar module).
>
> ----------
> components: Interpreter Core
> messages: 270581
> nosy: James.Lu
> priority: normal
> severity: normal
> status: open
> title: Dictionary iterator has no len()
> type: enhancement
> versions: Python 3.6
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue27532>
> _______________________________________
>
msg270585 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2016-07-16 21:24
If you read issue 24849, you will see that iterators having len was rejected by Guido long ago.
msg270587 - (view) Author: James Lu (James.Lu) * Date: 2016-07-16 22:15
I think you closed it too quickly. You see, computing the length of
combinations() doesn't require looping all the way through the iterator;
you can compute it quickly. I created a wrapper class just for this purpose.

On Sat, Jul 16, 2016 at 5:24 PM, R. David Murray <report@bugs.python.org>
wrote:

>
> R. David Murray added the comment:
>
> If you read issue 24849, you will see that iterators having len was
> rejected by Guido long ago.
>
> ----------
> nosy: +r.david.murray
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue27532>
> _______________________________________
>
msg270589 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2016-07-16 22:19
Please read the referenced issue.  Your points are addressed there.
History
Date User Action Args
2016-07-16 22:19:10r.david.murraysetmessages: + msg270589
2016-07-16 22:15:52James.Lusetmessages: + msg270587
2016-07-16 21:24:23r.david.murraysetnosy: + r.david.murray
messages: + msg270585
2016-07-16 21:23:09r.david.murraysetstatus: open -> closed
2016-07-16 21:22:53r.david.murraysetsuperseder: Add __len__ to map, everything in itertools
resolution: duplicate
stage: resolved
2016-07-16 21:15:16James.Lusetmessages: + msg270584
2016-07-16 19:08:04James.Lucreate