Thank you Lars, I had the feeling that this behavior should be something related to Python, but I was impressed by the inconsistency, because in my first example everything worked as (I) intended.
So, if this is a feature of Python I have to study it carefully ! Best regards Giovanni On Dec 14, 1:05 pm, Lars Fischer <lars.fischer...@googlemail.com> wrote: > Hello Giovanni, > > you have hit one of my favorite Python Pitfalls: Python does always > call by value, but sometimes it behaves like call by reference . > > The explanation is hidden in a footnote in the tutorial. Please see > "Defining Functions" in "More Control Flow Tools" in the Python > Tutorial:http://docs.python.org/tutorial/controlflow.html#defining-functions > > "The actual parameters (arguments) to a function call are introduced > in the local symbol table of the called function when it is called; > thus, arguments are passed using call by value (where the value is > always an object reference, not the value of the object). [1] When a > function calls another function, a new local symbol table is created > for that call." > > And the footnotes is: > [1] Actually, call by object reference would be a better description, > since if a mutable object is passed, the caller will see any changes > the callee makes to it (items inserted into a list). > > With best regards, > Lars --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---