A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2008-December/084073.html below:

[Python-Dev] Python-3.0, unicode, and os.environ

[Python-Dev] Python-3.0, unicode, and os.environTerry Reedy tjreedy at udel.edu
Sun Dec 7 22:20:06 CET 2008
Toshio Kuratomi wrote:

>   - If this is true, a definition of os.listdir(<type 'str'>) that would
> better meet programmer expectation would be: "Give me all files in a
> directory with the output as str type".  The definition of
> os.listdir(<type 'bytes'>) would be "Give me all files in a directory
> with the output as bytes type".  Raising an exception when the filenames
> are undecodable is perfectly reasonable in this situation.

Your examples (snipped) pretty well convince me that there is a use case 
for raising exceptions.  We should move beyond arguing over which one 
way is right.  I think there should be a second argument 
'ignorebad=False' to ignore undecodable files rather than raise the 
exception (or 'strict=True' to stop and raise exception on non-decodable 
names -- then code is 'if strict: raise ...').  I believe other 
functions have a similar parameter.

tjr

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4