On 18 Nov 2005 06:30:58 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]
> wrote:
Informative print statements can help you to see and understand the program flow, especially if the problem is conceptual, with no *real* errors in your "script"
def add(x, y):
print 'P1:', x,y
if x == 0:
print 'P2:', y
return y
else:
x -= 1
y += 1
print "P3:",x,y
add(x, y)
print "p4"
print 'P5'
#implied return is here, so I will add it
return # returns None **to the next level up**
print add(2, 4)
>>> reload(addtest)
P1: 2 4
P3: 1 5
P1: 1 5
P3: 0 6
P1: 0 6
P2: 6
p4
P5
p4
P5
None
> I still don't get it. I tried to test with x = 0 and found that to
Informative print statements can help you to see and understand the program flow, especially if the problem is conceptual, with no *real* errors in your "script"
def add(x, y):
print 'P1:', x,y
if x == 0:
print 'P2:', y
return y
else:
x -= 1
y += 1
print "P3:",x,y
add(x, y)
print "p4"
print 'P5'
#implied return is here, so I will add it
return # returns None **to the next level up**
print add(2, 4)
>>> reload(addtest)
P1: 2 4
P3: 1 5
P1: 1 5
P3: 0 6
P1: 0 6
P2: 6
p4
P5
p4
P5
None
-- http://mail.python.org/mailman/listinfo/python-list