[Python-Dev] [Python-3000] New proposition for Python3 bytes filename issue

M.-A. Lemburg mal at egenix.com
Wed Oct 1 11:32:30 CEST 2008

On 2008-10-01 09:54, Ulrich Eckhardt wrote:
> On Tuesday 30 September 2008, M.-A. Lemburg wrote:
>> On 2008-09-30 08:00, Martin v. Löwis wrote:
>>>> Change the default file system encoding to store bytes in Unicode is
>>>> like introducing a new Python type: <fake Unicode for filename hacks>.
>>> Exactly. Seems like the best solution to me, despite your polemics.
>> Not a bad idea... have os.listdir() return Unicode subclasses that work
>> like file handles, ie. they have an extra buffer that holds the original
>> bytes value received from the underlying C API.
> Why does it have to be a Unicode subclass? In my eyes, a Unicode object 
> promises a few things, in particular that it contains a Unicode string. If it 
> now suddenly contains bytes without any further meaning, that would be bad.

Please read my entire email. I was proposing to store the underlying
non-decodeable byte string value in such a subclass. The Unicode value
of the object would then be that underlying value decoded as e.g.
Latin-1 in order to be able to work on it as text.

Path operations would have to be made aware of such subclasses and
operate on the underlying bytes value.

However, like Guido mentioned, this only works if all components are
indeed aware of such subclasses... and that's likely to fail for
code outside the stdlib.

Marc-Andre Lemburg

Professional Python Services directly from the Source  (#1, Oct 01 2008)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/

:::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! ::::

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611

More information about the Python-Dev mailing list