How can this be?

Bruno Desthuilliers bdesth.quelquechose at
Fri Feb 6 13:09:41 CET 2004

r.e.s. wrote:
> My problem is this ...
> Module A contains the definition of a function f.
> Module B contains:
>     from A import *
>     L = [0]
>     print L
>     x = f(L, 'a data string')
>     print L
> When Module B is imported/reloaded (in pythonwin), 
> the result printed in the interactive window is
>     [0]
>     [1]
> How can the list L have gotten changed??

Because you changed it in f() ?

> Without my posting the function def (which is
> very lengthy), can anyone possibly give me a 
> clue about what might be a likely cause of this
> behavior?  

Sorry, we are not psychic. The only assumption I can make is that f() 
changes the content of the first item in L.

>(It *is* irregular, isn't it?  ?) 

How could we tell ? If f() modifies L, it seems pretty regular that L is 


More information about the Python-list mailing list