-
-
Save sunu/8c90b951ccd69c8ded42 to your computer and use it in GitHub Desktop.
Inconsistent behavior of dict() in case of bytestring keys.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# sunu at Mission-Control in ~/gsoc/splash on git:py3 x [23:20:21] | |
$ python | |
Python 3.4.0 (default, Apr 11 2014, 13:05:11) | |
[GCC 4.8.2] on linux | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> key = b'key' | |
>>> | |
>>> dict1 = {} | |
>>> dict1[key] = key | |
>>> dict1 | |
{b'key': b'key'} | |
>>> | |
>>> | |
>>> dict2 = dict(key=key) | |
>>> dict2 | |
{'key': b'key'} | |
>>> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment