On Sunday 20 September 2009 03:59:21 Peng Yu wrote: > I know that strings or numbers are immutable when they passed as > arguments to functions. But there are cases that I may want to change > them in a function and propagate the effects outside the function. I > could wrap them in a class, which I feel a little bit tedious. I am > wondering what is the common practice for this problem.
You can just ignore the immutability. Nothing stops you doing something like this; def reader(port,buffer): buffer += port.read() return buffer and calling it repetitively until buffer is as long as you want it. - Hendrik -- http://mail.python.org/mailman/listinfo/python-list