Created
July 20, 2015 18:51
-
-
Save btipling/526c75ebf90a4ad67f2c to your computer and use it in GitHub Desktop.
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
~ $ python | |
Python 2.7.10 (default, Jun 2 2015, 17:24:15) | |
[GCC 4.2.1 Compatible Apple LLVM 6.1.0 (clang-602.0.53)] on darwin | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> l = [1] | |
>>> d = {} | |
>>> d[l] = "foo" | |
Traceback (most recent call last): | |
File "<stdin>", line 1, in <module> | |
TypeError: unhashable type: 'list' | |
>>> | |
~ $ node | |
> l = [1] | |
[ 1 ] | |
> d = new Map(); | |
Map {} | |
> d.set(l, "foo"); | |
Map { [ 1 ] => 'foo' } | |
> d.get(l); | |
'foo' | |
> d.keys() | |
{} | |
> d.values(); | |
{} | |
> d | |
Map { [ 1 ] => 'foo' } | |
> for (k of d) { console.log(k) } | |
[ [ 1 ], 'foo' ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment