[Python-Dev] bytes / unicode
Terry Reedy
tjreedy at udel.edu
Tue Jun 22 01:48:46 CEST 2010
On 6/21/2010 1:29 PM, P.J. Eby wrote:
> At 05:49 PM 6/21/2010 +0100, Michael Foord wrote:
>> Why is your proposed bstr wrapper not practical to implement outside
>> the core and use in your own libraries and frameworks?
>
> __contains__ doesn't have a converse operation, so you can't code a type
> that works around this (Python 3.1 shown):
>
> >>> from os.path import join
> >>> join(b'x','y')
> >>> join('y',b'x')
I am really unclear what result you intend for such mixed pairs, for all
possible mixed pairs, sensible or not. It would seem to me best to write
your own pjoin function that did exactly what you want over the whole
input domain.
--
Terry Jan Reedy
More information about the Python-Dev
mailing list