[Python-Dev] Adding the 'path' module (was Re: Some RFE for review)

Guido van Rossum gvanrossum at gmail.com
Mon Jul 4 09:44:09 CEST 2005


> Guido van Rossum:
> > Then maybe the code that handles Unicode paths in arguments should be
> > fixed rather than adding a module that encapsulates a work-around...

On 7/3/05, Neil Hodgson <nyamatongwe at gmail.com> wrote:
>    It isn't clear whether you are saying this should be fixed by the
> user or in the library.

I meant the library.

> For a quick example, say someone wrote some
> code for counting lines in a directory:
[deleted]

Ah, sigh. I didn't know that os.listdir() behaves differently when the
argument is Unicode. Does os.listdir(".") really behave differently
than os.listdir(u".")? Bah! I don't think that's a very good design
(although I see where it comes from). Promoting only those entries
that need it seems the right solution -- user code that can't deal
with the Unicode entries shouldn't be used around directories
containing unicode -- if it needs to work around unicode it should be
fixed to support that! Mapping Unicode names to "?????" seems the
wrong behavior (and doesn't work very well once you try to do anything
with those names except for printing).

Face it. Unicode stinks (from the programmer's POV). But we'll have to
live with it. In Python 3.0 I want str and unicode to be the same data
type (like String in Java) and I want a separate data type to hold a
byte array.

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list