Path PEP: What should Path(None) do?
Reinhold Birkenfeld
reinhold-birkenfeld-nospam at wolke7.net
Mon Jul 25 10:58:22 EDT 2005
Michael Hoffman wrote:
> Currently it returns Path('None'). This means I have to do a check on
> input before pathifying it to make sure it is not None.
>
> Perhaps it should throw ValueError?
The problem is that Path() currently acts like str() and will therefore
accept almost anything that has a string representation.
We can do two things: 1) restrict Path.__new__ arguments to be strings
or unicode only, or 2) special-case None and what else comes in mind.
I think 1) is the proper solution. Path() is not a general stringifier
as str(), and shouldn't act like one.
Reinhold
More information about the Python-list
mailing list