PEP 322: Reverse Iteration (REVISED, please comment)
Werner Schiendl
n17999950.temp.werner at neverbox.com
Tue Oct 28 14:41:33 EST 2003
Hi,
was it considered to name the function just "reverse"?
This would read very naturally to me:
for elem in reverse(seq):
print elem
Also if you use it in function calls it looks good to me:
x = dostuff(reverse(seq), a, b)
Another possibility would be to have a static method for iter:
for elem in iter.reversed(sed):
print elem
(in that case I'd use an attribute rather than a verb, because
the generated iter(ator) will be reverse_d_).
The static method approach would clearly document that the
result is an iterator (which none of the other names proposed
really does IMHO)
In general, I'm +1 on the PEP
regards
Werner
More information about the Python-list
mailing list