John Salerno schreef:
Ben Finney wrote:

John Salerno <[EMAIL PROTECTED]> writes:

num = 33

for x in xrange(10):
    print num += 1
Which is better done by 'num += 10'.

Can you come up with an example that isn't trivially replaced with
clearer code? That might make it clearer what your concern is.

::sigh:: No, unfortunately I don't have a strong enough grasp of Python
to give a really in-depth example. I understand what you're asking
though. Perhaps people don't use this idiom as much as I think they do,
so to give a trivial example to support my point isn't helpful.

Perhaps a function to print some text a number of times:

def print_n(text, n):
  for i in xrange(n):
    print text

(Though I guess you can replace that with print '\n'.join(msg * n) )

--
The saddest aspect of life right now is that science gathers knowledge
faster than society gathers wisdom.
  -- Isaac Asimov

Roel Schroeven
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to