On Sun, Apr 18, 2004 at 10:50:13PM -0400, Bob Ippolito wrote: ... > >Why useless? It returns the index. Why do I have to build a new > >concatinated list (or my own special index function) in order to get > >that information? > > It returns an index into some sequence that no longer exists. What > good is that? In my special case, it is essentially a ranking. I don't need to access the lists via the index. > >>exhaust all of your iterator and raise an exception, > > > >Yep, just as it would for lists. > > The difference is that the iterator's life is more or less over, > there's probably nothing useful you can do with it, but a list is not > changed by this operation. Note that the mathematical function index: Elems -> Integer has a right to live on its own with the application of list accesses. ;-) > >>If you want an object that acts like a list, you should use a list. > > > >I don't see anything inherently "listy" about index(). It just counts > >how many elements there are to reach elem. And obviously the > >functionality is already there in the operator module. I'm just > >proposing a little convenience. > > I think it's pretty rare that you would want to know this information > at the cost of exhausting some/all of your iterator... and if that > really is what you want, then you should just use operator.indexOf. > There are MANY iterable types, it's not reasonable to change them all. If that is the consensus, so be it. :-) I'm just proposing it as it's in the spirit of itertools. It also eliminates an asymmetry between lists and iterators as demonstrated by operator.index() which is supposed to implement the intrinsic operators. Admittedly, it might not be very common. -- Chris Stork <> Support eff.org! <> http://www.ics.uci.edu/~cstork/ OpenPGP fingerprint: B08B 602C C806 C492 D069 021E 41F3 8C8D 50F9 CA2F
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