foreach_reverse is better than ever

bearophile bearophileHUGS at lycos.com
Sun Feb 14 06:34:16 PST 2010


Michel Fortin:
> It's an amusing name in the way Andrei likes it, but the meaning isn't 
> very clear. "reverse" would be a better name.

In Python it's "reversed":

>>> a = [5,7,1,3]
>>> reversed(a)
<listreverseiterator object at 0x019E25B0>
>>> list(reversed(a))
[3, 1, 7, 5]

Python use verbs in past tense (like "sorted", "reversed", etc) to denote something that doesn't change the given input (while "sort" sorts in-place).

Bye,
bearophile



More information about the Digitalmars-d mailing list