(original) (raw)
On Thu, Apr 7, 2016 at 4:03 AM, Donald Stufft <donald@stufft.io> wrote:
It seems like it would be reasonable for pathlib.Path to call fspath on the
path passed to pathlib.Path.\_\_init\_\_, which would mean that if other libraries
implemented \_\_fspath\_\_ then you could pass their path objects to pathlib and
it would just work
and then any lib that needed a path, could simply wrap Path() around whatever was passed in.
This is much like using np.array() if you want numpy arrays -- it works great.
numpy is trickier because they are mutable and can be big, so you don't want to make a copy if you don't need to -- hence the np.asarray() function -- but Paths are immutable and far more lightweight.
-CHB
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker@noaa.gov