for loop without variable

Basilisk96 basilisk96 at gmail.com
Wed Jan 9 22:17:21 EST 2008


On Jan 9, 9:49 pm, erik gartz <eegun... at yahoo.com> wrote:
> The loop performs some actions with web services. The particular
> iteration I'm on isn't important to me. It is only important that I
> attempt the web services that number of times. If I succeed I
> obviously break out of the loop and the containing function (the
> function which has the loop in it) returns True. If all attempts fail
> the containing loop returns False.

Do you think you could apply something like this:

  def foo():print "fetching foo..."
  actions = (foo,)*5
  for f in actions:
      f()

  fetching foo...
  fetching foo...
  fetching foo...
  fetching foo...
  fetching foo...

..but not knowing your specific implementation, I may be off the wall
here.

Cheers,
-Basilisk96



More information about the Python-list mailing list