On Feb 3, 11:20 am, Paul McGuire <[EMAIL PROTECTED]> wrote:

[... some code... some words ... more code, etc. ...]

> But this still seems like a lot of work to avoid "for x in range(n):".

I agree.  The point of me using "for _ in xrange (n)" isn't to avoid
the for loop at all.  What I wanted was a pythonic way to express only
the necessary components of the loop, like the Ruby version "n.times
do { stuff }"  does.  There's no explicit index in the Ruby code,
because you don't care about it.

Now, if you could monkeypatch built-ins, I'd *almost* consider adding
a .times method to integers. But, of course, monkeypatching is evil. :-
>
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to