Remembered arguments to a function
wruuqr ewfjbc
vqrsdw at yahoo.com
Tue Mar 9 11:08:42 EST 2004
Should I have expected the behavior of this function?
Is this a bug? Is it wise to exploit this behavior?
def test(a, b, d={}):
'''
sample output:
Python 2.1.3 (#35, Apr 8 2002, 17:47:50) [MSC 32 bit
(Intel)] on win32
Type "copyright", "credits" or "license" for more
information.
>>> x = test(1, 2)
>>> x
{1: 2}
>>> x = test(3, 4)
>>> x
{3: 4, 1: 2}
>>> y = test(5, 6)
>>> y
{5: 6, 3: 4, 1: 2}
>>> test(7, 8)
{7: 8, 5: 6, 3: 4, 1: 2}
'''
d[a] = b
return d
__________________________________
Do you Yahoo!?
Yahoo! Search - Find what youre looking for faster
http://search.yahoo.com
More information about the Python-list
mailing list