path.py and directory naming: trailing slash automatic?
Max Erickson
maxerickson at gmail.com
Fri Nov 10 12:03:20 EST 2006
"metaperl.mogd at gmail.com" <metaperl.mogd at gmail.com> wrote:
> Hi,
>
> I'm a big fan of path.py. One thing that I think is a good idea
> is for directories to automatically have a slash appended to them
> if it is not automatically added. Eg:
>
> from path import path
>
> dir = path('/some/dir')
>
> x = dir + "file" # should yield /some/dir/file
>
>
> I emailed the author of path.py but I think he must be extremely
> busy. It took him 2-3 weeks to answer my first email and it's
> been longer than that for the one I sent regarding this.
>
just use '/' if that is what you want:
>>> from path import path
>>> d=path('/some/dir')
>>> d / "file"
path(u'/some/dir\\file')
>>>
If + also did that, it would be more difficult to change the extension
when renaming a file or whatever.
max
More information about the Python-list
mailing list