MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Can't abort a loop with Print inside (V6)

  • To: mathgroup at
  • Subject: [mg83226] Re: Can't abort a loop with Print inside (V6)
  • From: Bill Rowe <readnewsciv at>
  • Date: Thu, 15 Nov 2007 05:43:15 -0500 (EST)

On 11/14/07 at 4:49 AM, yaroslavvb at (Yaroslav Bulatov)

>Possible solution might be to have Mathematica suppress outputs
>consisting of very many cells. In other words, if the evaluation
>produces a million "Print" statements, it would give "a very large
>output was generated" and only show a few of them. Since new cells
>could be produced in real-time, it could group excessive cells by
>time, ie, all cells sent in 0.1 seconds could be put in the first "a
>very large output" group, cells after that would go into second
>group, etc.

>But an even simpler solution would be to give user a throttle option
>-- if the front-end receives more than t output cells in 1 second,
>it would print something like "further output suppressed" and ignore
>kernel output for a few seconds.

Even simpler would be to drastically reduce the number of times
the loop runs.

The only reason I can see for putting a Print statement in the
loop is for debugging purposes. Surely no one wants to have 1000
Print statements execute or even 100.

Reduce the number of loops to something convenient, say 5-10.
That should provide enough information for debugging purposes.
Once the loop is debuggged, remove the Print statement and set
the loop to run the desired number of times.

The bottom line is it will always be possible to code loops that
are difficult to interrupt. Better to debug such loops by only
allowing them to run a few times before running the real case.
And if a throttle is needed, simply insert a Pause[n] statement
with the appropriate value for n and the problem goes away.
To reply via email subtract one hundred and four

  • Prev by Date: Dot product of tensors is not computed in parallel
  • Next by Date: Re: DelaunayTriangulation[] output
  • Previous by thread: Re: Can't abort a loop with Print inside (V6)
  • Next by thread: Re: Re: Can't abort a loop with Print inside (V6)