STINNER Victor added the comment: The idea was discussed many times, and there are existing implementations:
http://mail.python.org/pipermail/python-ideas/2013-January/018756.html http://www.astropython.org/snippet/2009/10/chdir-context-manager http://stackoverflow.com/questions/169070/python-how-do-i-write-a-decorator-that-restores-the-cwd ... The idea was rejected because it is "an anti-pattern" "encouraging a bad habit". The current working directory is something global, as locales on UNIX: in a multithreaded application, all threads would be affected by such change. It's better to work only with absolute paths and never call os.chdir(). ---------- nosy: +haypo _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue9097> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com