Why doesn't Python remember the initial directory?

Roy Smith roy at panix.com
Sun Aug 19 23:03:11 CEST 2012


In article <k0rj38$2gc$1 at reader1.panix.com>, kj <no.email at please.post> 
wrote:

> As far as I've been able to determine, Python does not remember
> (immutably, that is) the working directory at the program's start-up,
> or, if it does, it does not officially expose this information.

Why would you expect that it would?  What would it (or you) do with this 
information?

More to the point, doing a chdir() is not something any library code 
would do (at least not that I'm aware of), so if the directory changed, 
it's because some application code did it.  In which case, you could 
have just stored the working directory yourself.


More information about the Python-list mailing list