hi,

here is a function I have written:

def getaccbal(accnt,bal):
    account = Account.objects.get(pk=accnt)
    
    if account.vouch:
        bal = bal + getledgerob(account)
    else:
        children = account.account_set.all()
        for child in children:
            getaccbal(child.id,bal)
    return bal

if I try this with bal=0, on each recursion bal gets reset to 0 and I always 
get a 0 as a result. (If I put bal=20, result is 20). Must be something very 
simple that I am missing.
-- 
regards
Kenneth Gonsalves
Senior Associate
NRC-FOSS
http://certificate.nrcfoss.au-kbc.org.in
_______________________________________________
BangPypers mailing list
[email protected]
http://mail.python.org/mailman/listinfo/bangpypers

Reply via email to