On Thu, Apr 7, 2016 at 4:03 AM, Donald Stufft <don...@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.bar...@noaa.gov
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to