On 4/11/22, Chris Angelico <ros...@gmail.com> wrote: > > If you say `open("/spam")`, Windows uses "default drive" + "explicit > directory".
You can think of a default drive as being the drive of the current working directory, but there is no "default drive" per se that's stored separate from the working directory. Python and most other filesystem libraries generalize a UNC "\\server\share" path as a 'drive', in addition to drive-letter drives such as "Z:". However, the working directory is only remembered separately from the process working directory in the case of drive-letter drives, not UNC shares. If the working directory is r"\\server\share\foo\bar", then r"\spam" resolves to r"\\server\share\spam". If the working directory is r"\\server\share\foo\bar", then "spam" resolves to r"\\server\share\foo\bar\spam". However, the system will actually access this path relative to an open handle for the working directory. A handle for the process working directory is always kept open and thus protected from being renamed or deleted. Per-drive working directories are not kept open. They're just stored as path names in reserved environment variables. > Hence there are 26 current directories (one per drive), plus the > selection of current drive, which effectively chooses your current > directory. If the process working directory is a DOS drive path, then 26 working directories are possible. If the process working directory is a UNC path, then 27 working directories are possible. _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/OR65GYLNYOV4LT3ZEM3YFIVHSOP3D664/ Code of Conduct: http://python.org/psf/codeofconduct/