homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: getcwd problem does not return cwd
Type: Stage: resolved
Components: Interpreter Core Versions: Python 2.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: fif0, r.david.murray
Priority: normal Keywords:

Created on 2012年02月09日 22:12 by fif0, last changed 2022年04月11日 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
maybe_a_bug.py fif0, 2012年02月09日 22:12
Messages (2)
msg152991 - (view) Author: (fif0) Date: 2012年02月09日 22:12
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.
msg152995 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012年02月09日 22:40
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:26adminsetgithub: 58188
2012年02月09日 22:40:50r.david.murraysetstatus: open -> closed

nosy: + r.david.murray
messages: + msg152995

resolution: not a bug
stage: resolved
2012年02月09日 22:18:02fif0settitle: getcwd problem -> getcwd problem does not return cwd
2012年02月09日 22:12:58fif0create

AltStyle によって変換されたページ (->オリジナル) /