M.-A. Lemburg wrote:
> 
> Well, this is not too far away from just putting the whole decoding
> logic into the application directly:
> 
> files = [filename.decode(filesystemencoding, errors='warnreplace')
>          for filename in os.listdir(dir)]
> 
> (or os.listdirb() if that's where the discussion is heading)

I see what you mean, and yes, I think os.listdirb will do just as
well.  There is no need for any extra parameters to os.listdir.  The
typical application will just obliviously use os.listdir(dir) and get
the default elide-and-warn behaviour for un-decodable names.  That
rare special application that needs more control can use os.listdirb
and handle decoding itself.

Using a global registry of error handlers would just get in the way of
an application that needs more control.

- Anders
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to