Jean-Paul Calderone wrote: > > I like the exception that 2.5 raises. I only wish it raised by default > when using 'ascii' and u'ascii' as keys in the same dictionary. ;) Oh, > and that str and unicode did not hash like they do. ;) No problem: >>> import sys >>> reload(sys) <module 'sys' (built-in)> >>> sys.setdefaultencoding("base64") >>> "a"==u"a" Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/exp/lib/python2.5/encodings/base64_codec.py", line 42, in base64_decode output = base64.decodestring(input) File "/exp/lib/python2.5/base64.py", line 321, in decodestring return binascii.a2b_base64(s) binascii.Error: Incorrect padding >>> "a"=="a" True >>> d={u"a":1, "a":1} Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/exp/lib/python2.5/encodings/base64_codec.py", line 42, in base64_decode output = base64.decodestring(input) File "/exp/lib/python2.5/base64.py", line 321, in decodestring return binascii.a2b_base64(s) binascii.Error: Incorrect padding Maybe this is all just a matter of choosing the right defaultencoding ? :) BTW, python 2.4 also suppresses this exception (when instantiating the dictionary) Does python 2.4 catch any exception when comparing keys (which are not basestrings) in dictionaries? - Ralf
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