As per my knowledge, I think the request for 'n' raises a NameError. This is since n is a variable local to func and we cannot access it elsewhere. It is also true that Python only evaluates default parameter values once; every invocation shares the default value. If one invocation modifies it, that is what another gets. This means you should only ever use primitives, strings, and as default parameters, not mutable objects.
Is there an error in the code?
Is there an error in the code?
|
|
Messages In This Thread |
Is there an error in the code? - by himanibansal - Dec-19-2018, 12:21 PM
RE: Is there an error in the code? - by buran - Dec-19-2018, 12:37 PM
RE: Is there an error in the code? - by dukoolsharma - Dec-20-2018, 06:15 AM
|
Users browsing this thread: 2 Guest(s)