You're actually calling the read2() function from within read2(). This
is called recursion, and it is *not* what you want in this case, since
it unnecessarily fills up your call stack. Remember that a while loop
automatically goes back to the top without you having to re-call your
function. I would just do this:
def read3():
expr = raw_input("Lisp> ")
while expr != "quit":
print parse(expr)
expr = raw_input("Lisp> ")
print "Good session!"
ssecorp wrote:
in read2 it never quits when I write quit, why?
def read():
expr = raw_input("Lisp> ")
if expr != "quit":
print parse(expr)
read()
else:
print "Good session!"
def read2():
expr = ""
while expr != "quit":
expr = raw_input("Lisp> ")
print parse(expr)
read2()
print "Good session!"
--
http://mail.python.org/mailman/listinfo/python-list