On Dec 15, 2008, at 12:53 PM, Simon King wrote:
> Dear Lars, dear Robert,
>
>> 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-
>> function
Dear Lars, dear Robert,
> 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
That part of the documentation seems misleading to me and
On Dec 14, 2008, at 4:05 AM, Lars Fischer 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 .
Correction, Python *always* does call by reference. Fortunately, most
basic types (ints,
Hello Giovanni,
most of the time it does "the right thing". If you really need call by
value, whatever type the argument is, you can (must) copy the argument
yourself. The copy module provides the methods copy.copy() and
copy.deepcopy() for this situation.
With best regards,
Lars
--~--~
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
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: