Ron Adam <rrr at ronadam.com> wrote: > Why was it decided that the unicode encoding argument should be ignored > if the first argument is a string? Wouldn't an exception be better > rather than give the impression it does something when it doesn't? >From the PEP: There is no sane meaning that the encoding can have in that case. str objects *are* byte arrays and they know nothing about the encoding of character data they contain. We need to assume that the programmer has provided str object that already uses the desired encoding. Raising an exception would be a valid option. However, passing the string through unchanged makes the transition from str to bytes easier. Neil
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