The basic idea of reinteract is that reinteract saves a copy of the scope dictionary after every statement. If it needs to recompile starting from a particular statement, it then has the right scope to execute that statement in.
b = a + 1
This is pretty efficient because variables that stay the same can be shared between successive scopes, so the only memory used is for the scope dictionaries themselves. However, if reinteract detects that a statement modifies a variable, then it makes a shallow copy of the variable using copy.copy()
l = 5
Some types of modification are easy to detect, like the slice assignment above or assigning to an attribute. However, some modifications are harder to detect. Compare:
l.append(2) # modifies l
l.count(2) # no modification
The rule that reinteract uses is that a bare method call like the ones above is probably a modification, and it conservatively makes a copy in that case. You can avoid a copy by using a temporary variable or explicitly printing the result.
print l.count(2) # no copy
c = l.count(2); # no copy