[Python-Dev] splitext('.cshrc')
Nicholas Bastin
nick.bastin at gmail.com
Tue Mar 6 20:08:19 CET 2007
On 3/6/07, Phillip J. Eby <pje at telecommunity.com> wrote:
> At 07:24 PM 3/6/2007 +0100, Martin v. Löwis wrote:
> >given a list of file names, classify them for display (the
> > way the Windows explorer works, and similar file managers).
> > They use MIME databases and the like, and if they are unix-ish,
> > they probably reject the current splitext implementation already
> > as incorrect, and have work-arounds.
>
> I know I've written code like this that *depends* on the current
> behavior. It's *useful* to classify e.g. .svn directories or .*rc files by
> their "extension", so I'm honestly baffled by the idea of wanting to treat
> such files as *not* having an extension (as opposed to a
> possibly-unrecognized one).
My argument would be that the file is not 'unnamed', with an extension
of 'cshrc'. The file is actually called 'cshrc', and the '.' is
metadata that is attached to tell the shell to hide the file.
Assuming that we want ot be ignorant of shell semantics (and I think
we do), then the file is called '.cshrc', and it has no extension.
The notion of an unnamed file with an extension I think would be very
odd to most people.
+1 to changing the behaviour to return .cshrc as the filename, with no
extension.
--
Nick
More information about the Python-Dev
mailing list