Oh yes -- one more use for being able to copy an iterator: If you can't copy an iterator, how can you determine the value to which the iterator refers without losing access to that value? Oren> Why not translate *what* they do instead of *how* they do it? Oren> I'm pretty sure the Python way would be shorter and simpler Oren> anyway. Maybe yes, maybe no. It would certainly be different, because the C++ algorithms generally assume that iterators support comparison operations. That assumption makes possible algorithms in C++ that are difficult to express at all using Python iterators as they stand. On the other hand, the availability of garbage collection in Python, combined with the dynamic nature of its type system, makes it possible to express algorithms in Python that cannot be expressed easily in C++ using C++ iterators as they now stand. Details about language design can have a profound effect on usage, which in turn has a profound effect on future design. -- Andrew Koenig, ark@research.att.com, http://www.research.att.com/info/ark
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4