On 2/20/2012 1:33 PM, antoine.pitrou wrote:
http://hg.python.org/cpython/rev/c760bd844222 changeset: 75058:c760bd844222 user: Antoine Pitrou<solip...@pitrou.net> date: Mon Feb 20 19:30:23 2012 +0100 summary: Issue #13641: Decoding functions in the base64 module now accept ASCII-only unicode strings. Patch by Catalin Iacob.
+ tests = {b"d3d3LnB5dGhvbi5vcmc=": b"www.python.org", + b'AA==': b'\x00', + b"YQ==": b"a", + b"YWI=": b"ab", + b"YWJj": b"abc", + b"YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNE" + b"RUZHSElKS0xNTk9QUVJTVFVWV1hZWjAxMjM0\nNT" + b"Y3ODkhQCMwXiYqKCk7Ojw+LC4gW117fQ==": + + b"abcdefghijklmnopqrstuvwxyz" + b"ABCDEFGHIJKLMNOPQRSTUVWXYZ" + b"0123456789!@#0^&*();:<>,. []{}", + b'': b'', + } + for data, res in tests.items():
I am a little puzzled why a constant sequence of pairs is being stored as a mapping instead of a tuple (or list) of 2-tuples (which is compiled more efficiently). As near as I can tell, 'tests' and similar constructs later in the file are never used as mappings. Am I missing something or is this just the way Catalin wrote it?
-- Terry Jan Reedy _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com