diff options
Diffstat (limited to 'py/obj.c')
| -rw-r--r-- | py/obj.c | 5 |
1 files changed, 5 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 @@ -179,6 +181,9 @@ bool mp_obj_equal(mp_obj_t o1, mp_obj_t o2) { } machine_int_t mp_obj_get_int(mp_obj_t arg) { + // This function essentially performs implicit type conversion to int + // Note that Python does NOT provide implicit type conversion from + // float to int in the core expression language, try some_list[1.0]. if (arg == mp_const_false) { return 0; } else if (arg == mp_const_true) { |
