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
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