Timothee Cour:

3A)
why not having an Enumerate(R) containing a single 'opApply' public method,

Unfortunately opApply doesn't not work well with all the other range-based functions. Also that Enumerate code is for illustrative purposes, it's not meant to be good library code.


3B)
requiring one to use 'myrange.enumerate' for inputRanges and 'myrange' in
other cases is bad for generic programming and user time.

Generic programming must know if you are iterating only on items or on index-item pairs. As Python Zen says, explicit is better than implicit.


This is a very
frequent idiom that should just work out of the box. Language is more
orthogonal and less surprising in this case.

Yet Python designers have preferred to use enumerate instead of messing with the Python for.

Bye,
bearophile

Reply via email to