In lisp you can say:
(setf (aref a 1) 5)
In perl you can say:
substr( $string, $start, $stop ) =~ s/a/b/g
No, there isn't any way to do this in general. The slice notation comes close in a limited case, as you can do things like this:
>>> a = [1, 2, 3] >>> a[1:2] = [5, 6] >>> a [1, 5, 6, 3]