On Wed, Dec 2, 2026, at 12:16, Rob Cliffe via Python-list wrote:
> This is all on Windows.
> I was surprised to discover that
>      os.path.split(".")
> returns
>      ('', '.')
> rather than
>      ('.', '')
> i.e. the dot is treated as (part of) a file name rather than a directory 
> name.
> After all, "." is not a valid file name (though it could be part of a 
> file name) but IS a valid directory name.
> Is there a good reason for this?

This is the same as if you do "foo/." or "foo/.." - it may be the name *of* a 
directory, but the directory it's the name of is the one you're directly 
interested in, not its parent. Directories are a type of file after all.

The empty string definitely is not a valid filename, anyway.
-- 
https://mail.python.org/mailman3//lists/python-list.python.org

Reply via email to