> Special-casing the 2 argument case helps a lot. It brings the performace > within 50% of nested loops which means that if you actually do something > inside the loop the overhead is quite negligible. Hm, I tried that and found no difference. Maybe I didn't benchmark right. > Ahh... re-iterability again... > > This is a good example of a function that *fails silently* for non > re-iterable arguments. This failure is hardly silent IMO: the results are totally bogus, which is a pretty good clue that something's wrong. > Slurping the tail into a list loses the lazy efficiency of this function. > One of the ways I've used this function is to scan combinations until a > condition is satisfied. The iteration is always terminated before reaching > the end. Reading ahead may waste computation and memory. I don't understand. The Cartesian product calculation has to iterate over the second argument many times (unless you have it iterate over the first argument many times). So a lazy argument won't work. Am I missing something? > All I want is something that will raise an exception if any argument but > the first is not re-iterable (e.g. my reiter() proposal). I'll add list() > to the argument myself if I really want to. Don't try to guess what I > meant. Actually, I don't want to reiterate this debate. --Guido van Rossum (home page: http://www.python.org/~guido/)
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