[issue16540] Make itertools count, cycle, and repeat objects subscriptable like range.

2012-11-26 Thread Jesús Cea Avión
Changes by Jesús Cea Avión : -- nosy: +jcea ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.

[issue16540] Make itertools count, cycle, and repeat objects subscriptable like range.

2012-11-23 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- resolution: -> rejected status: open -> closed ___ Python tracker ___ ___ Python-bugs-list mailing

[issue16540] Make itertools count, cycle, and repeat objects subscriptable like range.

2012-11-23 Thread Neil Girdhar
Neil Girdhar added the comment: Thanks, that works. One of the things I like about Python is that you can write what you mean. I figured that since I meant "repeat [] as many times as necessary", that I should write it that way. So, from an intuitive standpoint, I still feel that these iter

[issue16540] Make itertools count, cycle, and repeat objects subscriptable like range.

2012-11-23 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Why not use `dummy = [[]] * 3` as dummy? -- ___ Python tracker ___ ___ Python-bugs-list mailing li

[issue16540] Make itertools count, cycle, and repeat objects subscriptable like range.

2012-11-23 Thread Neil Girdhar
Neil Girdhar added the comment: My code looks like this: presignal_abd = [[], [0.1, 0.6], []] tarsignal_abd = [[], [0.4, 0.9], []] diagsignal_abd = [[], [0.1, 0.6, 0.7, 0.8], []] # etc. for (filename, observations, presignals, tarsignals, diagsignals, diagram_type) in z

[issue16540] Make itertools count, cycle, and repeat objects subscriptable like range.

2012-11-23 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: What kind of problem you want to solve? I'm sure there is a simple enough solution without changing itertools objects. -- ___ Python tracker

[issue16540] Make itertools count, cycle, and repeat objects subscriptable like range.

2012-11-23 Thread Neil Girdhar
Neil Girdhar added the comment: My suggestion is then to update collection.abc to have an InfiniteSequence, which inherits from Iterable, and adds abstract methods __getitem__ and mixin methods __iter__. Then, itertools count, cycle, and repeat could implement collection.abc.InfiniteSequence,

[issue16540] Make itertools count, cycle, and repeat objects subscriptable like range.

2012-11-23 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > Apologies if this is a bad question, but why do count, cycle, and repeat > return iterators rather than iterables? Actually they are iterables too. -- ___ Python tracker

[issue16540] Make itertools count, cycle, and repeat objects subscriptable like range.

2012-11-23 Thread Éric Araujo
Éric Araujo added the comment: The point of itertools is to implement building blocks for iterators, which are memory-efficient and can sometimes be infinite, contrary to sequences. -- nosy: +eric.araujo ___ Python tracker

[issue16540] Make itertools count, cycle, and repeat objects subscriptable like range.

2012-11-23 Thread Neil Girdhar
Neil Girdhar added the comment: Apologies if this is a bad question, but why do count, cycle, and repeat return iterators rather than iterables? -- ___ Python tracker ___ __

[issue16540] Make itertools count, cycle, and repeat objects subscriptable like range.

2012-11-23 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Range, list, and tuple are iterables, but itertools.count, cycle, and repeat objects are iterators. Subscripting is not a part of iterator protocol. -- nosy: +serhiy.storchaka ___ Python tracker

[issue16540] Make itertools count, cycle, and repeat objects subscriptable like range.

2012-11-23 Thread Ezio Melotti
Changes by Ezio Melotti : -- nosy: +rhettinger stage: -> needs patch versions: -Python 3.1, Python 3.2, Python 3.3, Python 3.5 ___ Python tracker ___ __

[issue16540] Make itertools count, cycle, and repeat objects subscriptable like range.

2012-11-23 Thread Neil Girdhar
New submission from Neil Girdhar: When using sequence types polymorphically, range, list, and tuple are both iterable and subscriptable. Unfortunately, itertools.count, cycle, and repeat objects are not subscriptable, although this is not a hard change. Please consider making these objects su