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.
diff --git a/py/sequence.c b/py/sequence.c
index d3c3e32..1723bb4 100644
--- a/py/sequence.c
+++ b/py/sequence.c
@@ -149,9 +149,9 @@
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);
}
}