Friday 15 July 2011

Python: storing return value of a function -



Python: storing return value of a function -

i want store homecoming value of function in variable, every time utilize variable seems function ic called again.

is there way store result , not executing function every time ?

def get_password(crypto=false): pprompt = lambda: (getpass.getpass(), getpass.getpass('retype password: ')) p1, p2 = pprompt() while p1 != p2: print('passwords not match. seek again') p1, p2 = pprompt() if crypto == true: p1 = crypt.crypt(p1) homecoming p1 passwd = get_password()

using password create get_password phone call everytime.

python function

No comments:

Post a Comment