# Suggestion for pathlib: differentiate explicit and implicit local paths (pathlib.StrictPath?)

**URL:** <https://discuss.python.org/t/suggestion-for-pathlib-differentiate-explicit-and-implicit-local-paths-pathlib-strictpath/31235>\
**Category:** Ideas\
**Created:** [August 8, 2023, 9:08am UTC](https://discuss.python.org/t/suggestion-for-pathlib-differentiate-explicit-and-implicit-local-paths-pathlib-strictpath/31235 "2023-08-08T09:08:23Z")\
**Posts on this page:** 1\
**Showing post:** 31

<div class="post-metadata">

**Author:** ![barneygale](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/barneygale/32/1882_2.png) [@barneygale](https://discuss.python.org/u/barneygale)\
**Post date:** [January 5, 2024, 8:06pm UTC](https://discuss.python.org/t/suggestion-for-pathlib-differentiate-explicit-and-implicit-local-paths-pathlib-strictpath/31235/31 "2024-01-05T20:06:30Z")

</div>

Related discussion: [Pathlib: preserve trailing slash](https://discuss.python.org/t/pathlib-preserve-trailing-slash/33389)

An exchange I found super informative:

> [@Pathlib: preserve trailing slash](https://discuss.python.org/t/pathlib-preserve-trailing-slash/33389/47):
>
> > [@Pathlib: preserve trailing slash](https://discuss.python.org/t/pathlib-preserve-trailing-slash/33389/35):
> >
> > users should be able to safely refactor `os.stat(some_string)` to `pathlib.Path(some_string).stat()` without changing the result of the stat()
> 
> Well, if that becomes a design goal for pathlib, then it means you’re turning pathlib into something else. From “a library to handle filesystem paths” to “an object-oriented replacement for `os` and `shutil`”.

Pathlib’s handling of `.` segments, trailing slashes, etc, isn’t some accident or optional feature - it’s at the very core of what pathlib is and does.

And so from my perch in Pedantry Corner, I might argue that Python doen’t really have an object-oriented version of `os.path`, and existing code using `os.path` can’t be safely ported to `pathlib` without some care being taken to avoid data loss. Honestly I don’t feel good about this, and I’m looking at whether @departure3560’s earlier suggestion that `Path` subclasses a new `StrictPath` class has legs. It fits rather well with my plans for the pathlib ABCs, which _should_ result in a very straightforward/obvious implementation. I’ll share a prototype when I have one.

---

_[View the full topic](https://discuss.python.org/t/suggestion-for-pathlib-differentiate-explicit-and-implicit-local-paths-pathlib-strictpath/31235)._
