Duncan Booth <[EMAIL PROTECTED]> wrote:
> lazy <[EMAIL PROTECTED]> wrote:
>> I want to pass a string by reference. I understand that strings are
>> immutable, but Im not
>> going to change the string in the function, just to aviod the overhead
>> of copying(when pass-by-value) because the
>> strin
Steven D'Aprano <[EMAIL PROTECTED]> wrote:
...
> Python does NOT support pass by reference. Nor does it do pass by value.
> Both of those models might describe what other languages do, but they
> don't describe what Python does.
> Python's passing model is different from both pass by reference
On Thu, 10 May 2007 14:53:46 -0700, Gary Herron wrote:
> Strings *are* passed by reference *always*. There is no copy and no
> overhead. Efficiency is not based on length. Since the string is
> immutable, nothing you do inside the function can change the string
> outside the function.
Python d
lazy <[EMAIL PROTECTED]> wrote:
> I want to pass a string by reference. I understand that strings are
> immutable, but Im not
> going to change the string in the function, just to aviod the overhead
> of copying(when pass-by-value) because the
> strings are long and this function will be called ov
On May 10, 6:19 pm, lazy <[EMAIL PROTECTED]> wrote:
> So, just to make sure even if I return a value, there is no copy done.
> Is it correct?
> For eg:
>
> def blah:
>long_str=""
>return long_str
>
> my_str=blah() <=== So here there is no copy done but, my_str points to
> the same memor
Thanks all.
> the function you pass it to assigns some other value to the variable,
> that's all it's doing: reassigning a local name to point to somewhere
> else in memory.
So, just to make sure even if I return a value, there is no copy done.
Is it correct?
For eg:
def blah:
long_str=""
On May 10, 5:47 pm, Adam Atlas <[EMAIL PROTECTED]> wrote:
> On May 10, 5:43 pm, lazy <[EMAIL PROTECTED]> wrote:
>
> > I want to pass a string by reference.
>
> Don't worry, all function parameters in Python are passed by reference.
Actually, just to clarify a little bit if you're understanding "pa
lazy a écrit :
> Hi,
>
> I want to pass a string by reference. I understand that strings are
> immutable, but Im not
> going to change the string in the function, just to aviod the overhead
> of copying(when pass-by-value) because the
> strings are long and this function will be called over and ov
lazy wrote:
> Hi,
>
> I want to pass a string by reference. I understand that strings are
> immutable, but Im not
> going to change the string in the function,
You're confused here. "Immutable" means it *cannot* be changed, so your
decision to not change the string is not really your decision at
On May 10, 5:43 pm, lazy <[EMAIL PROTECTED]> wrote:
> I want to pass a string by reference.
Don't worry, all function parameters in Python are passed by reference.
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
I want to pass a string by reference. I understand that strings are
immutable, but Im not
going to change the string in the function, just to aviod the overhead
of copying(when pass-by-value) because the
strings are long and this function will be called over and over
again.
I initially thought
11 matches
Mail list logo