[Python-ideas] PEP 428 - object-oriented filesystem paths

Steven D'Aprano steve at pearwood.info
Tue Oct 9 10:42:41 CEST 2012


On Tue, Oct 09, 2012 at 08:36:58AM +0100, Paul Moore wrote:
> On 9 October 2012 06:41, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> > Antoine Pitrou wrote:
> >
> >> But you really want a short method name, otherwise it's better to have
> >> a dedicated operator.  joinpath() definitely doesn't cut it, IMO.
> >
> >
> > I agree, it's far too longwinded. It would clutter your code
> > just as badly as using os.path.join() all over the place does
> > now, but without the option of aliasing it to a shorter name.
> 
> Good point - the fact that it's not possible to alias a method name
> means that it's important to get the name right if we're to use a
> method, because we're all stuck with it forever.

Huh?

py> f = str.join  # "join" is too long and I don't like it
py> f("*", ["spam", "ham", "eggs"])
'spam*ham*eggs'


We should get the name right because we're stuck with it forever due to 
backwards compatibility, not because you can't alias it.



-- 
Steven



More information about the Python-ideas mailing list