[Python-Dev] / as path join operator (was: Re: The path module PEP)

BJörn Lindqvist bjourne at gmail.com
Thu Jan 26 19:45:09 CET 2006


I think that everything that can be said aboud __div__() has already
been said. But this argument was really convincing:

[Tony Meyer]
> The vast majority of people (at least at the time) were either +0 or
> -0, not +1.  +0's are not justification for including something.

There is no clear consensus either way. Ultimately, Guido will decide
if he thinks it is clever or not. Meanwhile I'll remove it from the
PEP and keep it as an "optional extension." Also, like Jason said, the
removal of __div__() leads to the ultimate demise of joinpath(), woho!

[Jason Orendorff]
> in which case I propose using the Path constructor as the
> replacement for os.path.join().  In that case, Path.joinpath can be
> dropped.

    Path.cwd() / "foobar"
    ==>
    Path(Path.cwd(), "foobar")

    Path("foo") / "bar" / "baz"
    ==>
    Path("foo", "bar", "baz")

Still, in the simpler cases, __div__() looks really handy:

    os.chdir(pkgdir / "include")
    ==>
    os.chdir(Path(pkgdir, "include"))

Oh well. You can't have everything, can you? The updated PEP and an
implementation is availible from
http://wiki.python.org/moin/PathClass.

--
mvh Björn


More information about the Python-Dev mailing list