The last few lines in the _eval_line function of
devel/sage/sage/interfaces/axiom.py look like

        outs = out.split("\n")
        i = 0
        outline = ''
        for line in outs:
            line = line.rstrip()
            # print "'%s'"%line
            if line[:4] == '   (':
                i = line.find('(')
                i += line[i:].find(')')
                if line[i+1:] == "":
                    i = 0
                    outs = outs[1:]
                break;
        out = "\n".join(line[i+1:] for line in outs[1:])
        return out

That's obviously buggy as can be seen at the output of )version at
http://sagenb.org/home/pub/2158/.

The first "i = 0" should become "i = -1"

The second thing I don't understand is:

(*)
                if line[i+1:] == "":
                    i = 0
                    outs = outs[1:]

That sounds like... If the line only contains the axiom prompt "(123)"
and nothing else then the first line is removed. If a string like
"   (1)" by accident appears in the middle of an axiom output the first
line is removed?

Actually it is already enought that "   (" starts a line in the output
stream. The for loop will be aborted. What is the rationale here?

Even worse. I don't think that changing the value of the list one
iterates over, is a good idea. Checkout...

r = range(5)
r.reverse()
for i in r:
    print i,r
    if i == 2:
        r.remove(3)

Can somebody tell me, why (*) is there at all?



Ralf

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to