`pathlib` trims trailing slashes by default, but certain packages require 
trailing slashes. In particular, `cx_Freeze.bdist_msi` option "directories" is 
used to build the package directory structure of a program and requires 
trailing slashes.

Does anyone think it would be a good idea to add a flag or argument to 
`pathlib.Path` to keep trailing slashes? For instance, I envision something 
like:

```
from pathlib import Path

my_path = Path(r"foo/bar/", keep_trailing_slash=True)
```

The argument could be made `False` by default to maintain backwards 
compatibility. The only way I know to keep the backslash and maintain 
cross-compatibility is as follows:

```
import os
from pathlib import Path

my_path = f"{Path(r"foo/bar").resolve()}{os.sep}"
```

although this returns a string and the `Path` object is lost.

Any thoughts?
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to