language-design tag

1 questions


1 answers
64 views
0
The default argument value keeps changing

I thought the code below would always return [5]The price keeps changing.I thought a=[] would be executed whenever foo() was executed, but is it not?What is happening in foo()?def foo(a=[]): a.append(...


© 2024 OneMinuteCode. All rights reserved.