[Python-Dev] Improvements for Pathlib

Cameron Simpson cs at zip.com.au
Sun Nov 9 04:18:23 CET 2014


On 08Nov2014 17:46, Ionel Cristian Mărieș <contact at ionelmc.ro> wrote:
>#2. A context manager for changing working directory (that switches to the
>old cwd on exit). Eg:
>
>with path.cd():
> assert os.getcwd() == path

As elsewhere remarked, the current working directory is process global state.  
Changing it can easily have unwanted (and invisible until breakage becomes 
glaring) side effects.

-1 on this element from me I'm afraid.

Cheers,
Cameron Simpson <cs at zip.com.au>

I couldn't think of anything else to do with it, so I put it on the web.


More information about the Python-Dev mailing list