On 12.04.2016 16:59, Random832 wrote:

Strings are strings. Paths are paths. That's were the difference is.
Yes but why aren't these both "things that you may want to use to open a
file"?

Because "things that you may want to use to open a file" is a bit vague and thus conceal the fact that we really need.

As an example: time.sleep takes a number of seconds (notice the primitive datatype just like a string) and does not take timedelta.

Why don't we add datetime.timedelta support to time.sleep? Very same thing.

The fact that there is one obvious thing to want to do
with open and a Path strongly suggests that that should be able to be
done by passing the Path to open.
Path(...).open() is your friend then. I don't see why you need os.open.
Because I'm passing it to modfoo.dosomethingwithafile() which takes a
filename and passes it to shutils, which passes it to builtin open,
which passes it to os.open.

Should Path grow a dosomethingwithmodfoo method?

Because we can argue here the other way round and say:

"oh, pathlib can do things, I cannot do with os.path."

Should os.path grow those things?


Put differently, you cannot do everything. But the most common issues should be resolved in the correct module. This is no argument for or against either solution.


I am sorry, if my contribution on the threads of python-ideas made it seem that I would always support this idea. I don't anymore. However, I will still be happy with the outcome even if not perfect, will help making the Python stdlib better. :)

Best,
Sven
_______________________________________________
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