473,807 Members | 2,883 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PEP 323: Copyable Iterators

Interested parties (essentially, people who write user-coded iterator, or
are intense users of iterators as "stream of data", of standard library
module itertools, etc) are welcome to read, and possibly comment on, a new
PEP on copyable iterators, see:

http://www.python.org/peps/pep-0323.html

The PEP is currently at revision 1.2, having already been amended and vastly
extended as a consequence of discussions on these issues on python-dev.
In brief, the PEP proposes that:

iterator types supply a __copy__ method, if, and only if, the method can
make an independently iterable copy of their instances at reasonably low
cost in time and memory;

the new function itertools.tee be optimized to exploit this method if its
argument iterators support it;

existing built-in iterator types be upgraded to supply this __copy__ method
where applicable;

user-written code normally rely on itertools.tee to get independently
iterable iterators on the same underlying sequence (occasionally, for
special needs, user-written code may feature-test an iterator for __copy__,
as long as said user code wants to deal directly and in special ways with
both cases, that of copyable iterators and that of non-copyable iterators).
Alex

Jul 18 '05 #1
2 1493
On Wed, 29 Oct 2003 18:09:49 GMT, Alex Martelli <al***@aleax.it >
wrote:
Interested parties (essentially, people who write user-coded iterator, or
are intense users of iterators as "stream of data", of standard library
module itertools, etc) are welcome to read, and possibly comment on, a new
PEP on copyable iterators, see:

http://www.python.org/peps/pep-0323.html

The PEP is currently at revision 1.2, having already been amended and vastly
extended as a consequence of discussions on these issues on python-dev.


Ah, an easy choice for a change. A definite +1 and no comments from
me.

With my best regards,
G. Rodrigues
Jul 18 '05 #2

"Alex Martelli" <al***@aleax.it > wrote in message
news:Nn******** ************@ne ws1.tin.it...
Interested parties (essentially, people who write user-coded iterator, or
are intense users of iterators as "stream of data", of standard library
module itertools, etc) are welcome to read, and possibly comment on, a new
PEP on copyable iterators, see:

http://www.python.org/peps/pep-0323.html

The PEP is currently at revision 1.2, having already been amended and vastly extended as a consequence of discussions on these issues on python-dev.


I don't see where I'd use it, but on the other hand it doesn't seem like it
would increase the complexity of Python much (if at all) and it does seem
like a rather obvious feature to have.

+1

John Roth
Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
2219
by: Steven Bethard | last post by:
So, as I understand it, in Python 3000, zip will basically be replaced with izip, meaning that instead of returning a list, it will return an iterator. This is great for situations like: zip(*) where I want to receive tuples of (item1, item2, item3) from the iterables. But it doesn't work well for a situation like: zip(*tuple_iter)
18
2308
by: deancoo | last post by:
I have gotten into the habit of often using copy along with an insert iterator. There are scenarios where I process quite a lot of data this way. Can someone give me a general feel as to how much of a performance hit I'm taking using this technique versus using 'copy' to copy directly into a container with elements in place? Thanks, d
1
1901
by: Marcin Kaliciñski | last post by:
template<class RanAccIt> void some_algorithm(RanAccIt begin, RanAccIt end) { // this algorithm involves calling std::lexicographical_compare // on range [begin, end), and on reverse of this range // (i.e. as rbegin, rend was passed) } How can I call lexicographical_compare inside the function so that it traverses the range backwards?
3
2929
by: codefixer | last post by:
Hello, I am trying to understand if ITERATORS are tied to CONTAINERS. I know the difference between 5 different or 6(Trivial, on SGI). But what I fail to understand is how can I declare all 5 kinds of iterators on say a vector. OR is it that any iterator declared on Vector is Random Iterator which has the functionality of all the others.
24
3970
by: Lasse Vågsæther Karlsen | last post by:
I need to merge several sources of values into one stream of values. All of the sources are sorted already and I need to retrieve the values from them all in sorted order. In other words: s1 = s2 = s3 = for value in ???(s1, s2, s3):
2
2357
by: ma740988 | last post by:
typedef std::vector < std::complex < double > > complex_vec_type; // option1 int main() { complex_vec_type cc ( 24000 ); complex_vec_type dd ( &cc, &cc ); } versus
90
3481
by: John Salerno | last post by:
I'm a little confused. Why doesn't s evaluate to True in the first part, but it does in the second? Is the first statement something different? False print 'hi' hi Thanks.
18
2125
by: desktop | last post by:
1) I have this code: std::list<intmylist; mylist.push_back(1); mylist.push_back(2); mylist.push_back(3); mylist.push_back(4);
0
1143
by: mbmessaoud | last post by:
Hi Is there a module in python that implement H.323 protocol I need such module to test a Gatekeeper or a H.323 module Any comment is welcome
0
9599
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10626
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10112
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7650
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6879
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5685
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4330
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3854
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3011
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.