Please please please, junk both "filter out bytes" proposals.

Since they involve an exception, they impose an unnecessary "try" on
all text applications that fear death on bytes returns.  May as well
just wrap all objects with __fspath__ in fsdecode, and all is
happy.

Counterproposal: make fsdecode and fsencode grok __fspath__.  Then:
(1) Bytes-lovers and str-addicts are both safe.
(2) They can omit fspath, too!

No, that doesn't work if the bytes objects aren't in the file system
encoding, but these are *bytes*, mon ami: you have no way to find out
what that encoding is, so you either know already and you substitute
that + fspath for fsdecode, or you're hosed.  And in the only concrete
use case so far, fsdecode Just Works.

I suppose a similar argument holds for applications that want bytes
and fsencode, but I leave that as an exercise for the reader.

_______________________________________________
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