[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how having the basename of a file or directory

From: Karl Fogel
Subject: Re: how having the basename of a file or directory
Date: Tue, 01 Feb 2011 11:52:46 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

"Stephen J. Turnbull" <address@hidden> writes:
>Karl Fogel writes:
> > "Stephen J. Turnbull" <address@hidden> writes:
> > > > or creating a basename function
> > >
> > >Un-Pythonic.  But then, this isn't Python, so I guess it's OK. ;-)
> > 
> >   $ python
> >   Python 2.6.6 (r266:84292, Dec 27 2010, 00:02:40) 
> >   >>> import os.path
> >   >>> os.path.basename("/home/kfogel/README")
> >   'README'
> >   >>> quit()
> >   $ 
>You know what I mean.  "Not every three-line function needs to be a
>built-in."  AFAIK Python doesn't have an equivalent to
>file-name-directory; you need to write that yourself.

Oh, sorry -- I didn't actually know that's what you meant.

(Sometimes people use "Pythonic" to mean "whatever matches my taste";
you were being more careful than that, but unfortunately it was lost on
me because I've been too degraded by other conversations.)

FWIW, for me the compelling argument for a `basename' function is that
then M-x apropos will find it (and programmers often need it).  Given
that "basename" seems to have become the standard term for this
functionality, we should take the simplest step that makes it findable
via that term.  If there's some other method that will accomplish the
same thing, that's fine.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]