Stephen J. Turnbull wrote:
Antoine Pitrou writes:
Richard Oudkerk wrote:
Maybe p.basename could be shorthand for p.name.split('.')[0].
Wouldn't there be some confusion with os.path.basename:
--> os.path.basename('a/b/c.ext') 'c.ext'
I wouldn't worry too much about this; after all, we are trying to replace a primitive system with a more advanced, user-friendly one.
Also there are applications where "basenames" contain periods (eg, wget often creates directories with names like "www.python.org"), and filenames may have multiple extensions, eg, "index.ja.html".
I think it's reasonable to define "extension" to mean "the portion after the last period (if any, maybe including the period), but I think usage of the complementary concept is pretty application- specific.
FWIW, my own implementation uses the names .path -> c:\foo\bar or \\computer_name\share\dir1\dir2 .vol -> c: \\computer_name\share .dirs -> \foo\bar \dir1\dir2 .filename -> some_file.txt or archive.tar.gz .basename -> some_file archive .ext -> .txt .tar.gz ~Ethan~