Please take a look at the detached file. At the first call of the methode foo(), path and the second getcwd are the same. After the directory change, the default value path is not the the current working directory.
That's just how function definitions in Python work. The prototype is evaluated when the function is defined, not when it is run, so the default value of path will always be the value of getcwd at the time the function *defintion* is done (which will generally be the CWD when python starts, unless you are defining functions at runtime).
History
Date
User
Action
Args
2022-04-11 14:57:26
admin
set
github: 58188
2012-02-09 22:40:50
r.david.murray
set
status: open -> closednosy: + r.david.murraymessages: + resolution: not a bugstage: resolved
2012-02-09 22🔞02
fif0
set
title: getcwd problem -> getcwd problem does not return cwd