Implement str.count and add tests for it.
Also modify mp_get_index to accept: 1. Indices that are or evaluate to a boolean. 2. Slice indices. Add tests for these two cases.
This commit is contained in:
@@ -149,9 +149,9 @@ mp_obj_t mp_seq_index_obj(const mp_obj_t *items, uint len, uint n_args, const mp
|
||||
uint stop = len;
|
||||
|
||||
if (n_args >= 3) {
|
||||
start = mp_get_index(type, len, args[2]);
|
||||
start = mp_get_index(type, len, args[2], true);
|
||||
if (n_args >= 4) {
|
||||
stop = mp_get_index(type, len, args[3]);
|
||||
stop = mp_get_index(type, len, args[3], true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user