Re: [Python-Dev] Pathlib enhancements - acceptable inputs and outputs for __fspath__ and os.fspath()

2016年4月11日 17:58:28 -0700

Ethan Furman wrote:
 # after new protocol with bytes/str support
 def zingar(a_path):
 a_path = fspath(a_path)
 if not isinstance(a_path, (bytes,str)):
 raise TypeError('bytes or str required')
 ...
I think that one would be just
 def zingar(a_path):
 a_path = fspath(a_path)
because fspath() would presumably check the result for
str/bytesness itself. At least I can't think of a reason
for it not to, since returning either str or bytes is
part of its contract.
--
Greg
_______________________________________________
Python-Dev mailing list
[email protected]
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