Avoiding referencing (was: Python sequences reference - problem?)

Greg Ewing see_reply_address at something.invalid
Mon Sep 23 03:28:40 CEST 2002

Thorsten Kampe wrote:

> 2. "If you don't want referencing, call it with a copy of 'foo' like: 
> part(foo[:], [2, 3])"
> Yes, but how do I know in advance that 'part' modifies 'foo'? I might 
> not be the author of 'part'.

But it ought to be clear from the documented purpose
of 'part' whether it changes the object that you pass
to it or not. It's generally expected that a function
won't make changes to its arguments unless there's a
good reason.

Greg Ewing, Computer Science Dept,
University of Canterbury,	
Christchurch, New Zealand

More information about the Python-list mailing list