mal wrote: > The above looks a lot like an iterator... how about > providing a standard PySequence_Iterate(obj, callback) > with the callback being called for every element of the > sequence ?! PySequence_Enumerate, perhaps? > The iterator could then be optimized for lists and tuples. > Not as fast as inlining, but a more generic solution... more generic than useful, imo: - it's slower. - it's awkward to use: you need to put the state in a structure, invert your program logic, etc. - it doesn't scale: what if you want to loop over two structures? what if you want to loop over two objects, using two different indices? </F>
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