9 Oct
2012
9 Oct
'12
8:48 p.m.
On Oct 9, 2012, at 10:11 AM, Eric V. Smith
One could also use "+" for adding to the last segment if it isn't a path object or a tuple:
pathA + ".tar.gz"
But then you'd have to say:
pathA + ("file.txt",)
or pathA + Path("file.txt") Just like with any tuple, if you wish to add a new part, it must be a tuple (Path) first. I'm not convinced that adding a string to a path should be allowed, but if not then we should probably throw a TypeError if its not a tuple or Path. That would leave the following method for appending a suffix: path[:-1] + Path(path[-1] + '.tar.gz') That's alot more verbose than the option to "add a string". Ryan