summaryrefslogtreecommitdiffstatshomepage
path: root/py
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2015-06-26 17:33:21 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2015-06-26 17:35:12 +0300
commitf44cc517a27062b3f419c6666e8aa660b6077ace (patch)
tree140b0c86efe6cc5cc7c309f36a1c16b43b47db44 /py
parentabfd4da287456f5e15b24251333dbdca934b2975 (diff)
downloadmicropython-f44cc517a27062b3f419c6666e8aa660b6077ace.tar.gz
micropython-f44cc517a27062b3f419c6666e8aa660b6077ace.zip
objstr: Add note that replace() is nicely optimized.
Doesn't allocate memory and returns original string if no replacements are to be made.
Diffstat (limited to 'py')
-rw-r--r--py/objstr.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/py/objstr.c b/py/objstr.c
index d11f097fca..0afc538b01 100644
--- a/py/objstr.c
+++ b/py/objstr.c
@@ -1465,6 +1465,8 @@ not_enough_args:
return mp_obj_new_str_from_vstr(&mp_type_str, &vstr);
}
+// The implementation is optimized, returning the original string if there's
+// nothing to replace.
STATIC mp_obj_t str_replace(mp_uint_t n_args, const mp_obj_t *args) {
assert(MP_OBJ_IS_STR_OR_BYTES(args[0]));