Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   path.py and directory naming: trailing slash automatic? (http://www.velocityreviews.com/forums/t396247-path-py-and-directory-naming-trailing-slash-automatic.html)

metaperl.mogd@gmail.com 11-10-2006 03:58 PM

path.py and directory naming: trailing slash automatic?
 
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.


Max Erickson 11-10-2006 05:03 PM

Re: path.py and directory naming: trailing slash automatic?
 
"metaperl.mogd@gmail.com" <metaperl.mogd@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



All times are GMT. The time now is 05:25 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.