function-calls

What is the scope of a defaulted parameter in Python?

What is the scope of a defaulted parameter in Python? Question: When you define a function in Python with an array parameter, what is the scope of that parameter? This example is taken from the Python tutorial: def f(a, L=[]): L.append(a) return L print f(1) print f(2) print f(3) Prints: [1] [1, 2] [1, 2, …

Total answers: 7