On Feb 10, 2008, at 9:13 PM, William Stein wrote:
> Any line with "random" anywhere in it is replaced by > > sage: _ = [the original line] > <newline> > [original output] <--- gets ignored because of the newline > > This is so doctests with random output can still be run using exactly > the same doctesting framework, but the output is not tested. > > This is a hack, clearly. It would be better to run the random input > line *exactly* as is, but just somehow ignore the output. When I > wrote [...] okay I see. A much better solution would be for sage to have a sane pseudo-random number framework, so we could be guaranteed sane behaviour for doctests like this. I realise how difficult this is, given how many systems there are in sage with different random number generators etc. Actually this burns me quite often for various reasons. I frequently have some code that I'm playing with, and I'm debugging deep into some complicated piece of code, and I have a piece of paper with various numbers written on it keeping track of what's supposed to be happening.... and then I run it again and I get totally different numbers and I have to work it all out again. It's a real pain, and quite unworkable. BTW this is a hack for two reasons. The "lesser hack" is that it rewrites code that is supposed to have random output. I suppose I can live with this. But the "greater hack", which is much more confusing to me, is that it gets applied for any line containing the string "random"!! That's totally unexpected and weird. i.e. I could live with: sage: some_func(5) # random 234736 where it's clearer that there is some decoration on the line. What about sage: rand_stuff() or sage: rnd_stuff() ? david --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---