Guido van Rossum wrote: > On Fri, Dec 5, 2008 at 2:27 AM, Ulrich Eckhardt <eckhardt at satorlaser.com> wrote: >> In 99% of all cases, using the default encoding will work and do what people >> expect, which is why I would make this conversion automatic. In all other >> cases, it will at least not fail silently (which would lead to garbage and >> data loss) and allow more sophisticated applications to handle it. > > I think the "always fail noisily" approach isn't the best approach. > E.g. if I am globbing for *.py, and there's an undecodable .txt file > in a directory, its presence shouldn't cause the glob to fail. > But why should it make glob() fail? This sounds like an implementation detail of glob. Here's some pseudo-code:: def glob(pattern): string = False if isinstance(pattern, str): string = True if platform == 'POSIX': pattern = bytes(pattern, encoding=defaultencoding) rawfiles = os.listdir(os.path.dirname(pattern) or pattern) if string and platform == 'POSIX': return [str(f) for f in rawfiles if match(f, pattern)] else: return rawfiles This way the traceback occurs if anything in the result set is undecodable. What am I missing? -Toshio -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 197 bytes Desc: OpenPGP digital signature URL: <http://mail.python.org/pipermail/python-dev/attachments/20081205/e67ab538/attachment-0001.pgp>
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