Implement `parts` using `_stack`, which itself calls `pathmod.split()`
repeatedly. This avoids use of `_tail`, which will be moved to `PurePath`
shortly.
return NotImplemented
return self._parts_normcase >= other._parts_normcase
+ @property
+ def parts(self):
+ """An object providing sequence-like access to the
+ components in the filesystem path."""
+ if self.drive or self.root:
+ return (self.drive + self.root,) + tuple(self._tail)
+ else:
+ return tuple(self._tail)
+
@property
def parent(self):
"""The logical parent of the path."""
def parts(self):
"""An object providing sequence-like access to the
components in the filesystem path."""
- if self.drive or self.root:
- return (self.drive + self.root,) + tuple(self._tail)
- else:
- return tuple(self._tail)
+ anchor, parts = self._stack
+ if anchor:
+ parts.append(anchor)
+ return tuple(reversed(parts))
def joinpath(self, *pathsegments):
"""Combine this path with one or several arguments, and return a