diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-04-05 12:50:43 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-04-05 12:51:58 +0300 |
commit | 91cbe6033a8fec6b11c414670f7ed75e9598857c (patch) | |
tree | c22a69449cf97dcd6a7ea7741453cd5211957844 /py/obj.c | |
parent | c6813d92db57c0973d0c93e1053deb4181076277 (diff) | |
download | micropython-91cbe6033a8fec6b11c414670f7ed75e9598857c.tar.gz micropython-91cbe6033a8fec6b11c414670f7ed75e9598857c.zip |
py: Allow types to be hashable.
Quite natural to have d[int] = handle_int .
Diffstat (limited to 'py/obj.c')
-rw-r--r-- | py/obj.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -118,6 +118,8 @@ machine_int_t mp_obj_hash(mp_obj_t o_in) { return (machine_int_t)o_in; } else if (MP_OBJ_IS_TYPE(o_in, &mp_type_tuple)) { return mp_obj_tuple_hash(o_in); + } else if (MP_OBJ_IS_TYPE(o_in, &mp_type_type)) { + return (machine_int_t)o_in; // TODO hash class and instances // TODO delegate to __hash__ method if it exists |