Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #75039

Re: Question about Pass-by-object-reference?

X-Received by 10.68.222.194 with SMTP id qo2mr12606002pbc.6.1406070006370; Tue, 22 Jul 2014 16:00:06 -0700 (PDT)
X-Received by 10.140.50.104 with SMTP id r95mr74132qga.13.1406070006320; Tue, 22 Jul 2014 16:00:06 -0700 (PDT)
Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!h18no5812508igc.0!news-out.google.com!cz11ni6302qab.1!nntp.google.com!v10no1975223qac.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.python
Date Tue, 22 Jul 2014 16:00:06 -0700 (PDT)
In-Reply-To <c3808lFn5iuU1@mid.individual.net>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=64.229.140.25; posting-account=SZ_svQkAAACWRFG2bDA-zgq8ILyl4-vo
NNTP-Posting-Host 64.229.140.25
References <cc0616eb-642a-426c-a995-6665ee4c52b9@googlegroups.com> <986eee35-0327-46e5-bce0-b1ae4572dd8f@googlegroups.com> <c3808lFn5iuU1@mid.individual.net>
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <8b5a4a1f-656b-4871-91c4-2091209eafe3@googlegroups.com> (permalink)
Subject Re: Question about Pass-by-object-reference?
From fl <rxjwg98@gmail.com>
Injection-Date Tue, 22 Jul 2014 23:00:06 +0000
Content-Type text/plain; charset=ISO-8859-1
Xref csiph.com comp.lang.python:75039

Show key headers only | View raw


On Tuesday, July 22, 2014 4:35:33 PM UTC-4, Peter Pearson wrote:
> On Tue, 22 Jul 2014 12:34:51 -0700 (PDT), fl <r@gmail.com> wrote:
> When you say "def reassign(list)", that means "I'm defining a function
> to which the caller will pass one object, and within this function I'm
> going to refer to that object by the name 'list'."
> 
> 
> 
> Then, when you say "list=[0,1]", that means "Create the object [0,1],

The above is what rebind? see below I cite.

> and assign to it the name 'list'."  At this point, there is no longer
> any name that refers to the object that the caller passed.

Here is I find on-line about "Arguments are passed by assignment."
http://stackoverflow.com/questions/986006/python-how-do-i-pass-a-variable-by-reference

"If you pass a mutable object into a method, the method gets a reference to that 
same object and you can mutate it to your heart's delight, but if you rebind the
reference in the method, the outer scope will know nothing about it, and after
you're done, the outer reference will still point at the original object."

Thanks

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Question about Pass-by-object-reference? fl <rxjwg98@gmail.com> - 2014-07-22 12:04 -0700
  Re: Question about Pass-by-object-reference? Ned Batchelder <ned@nedbatchelder.com> - 2014-07-22 15:32 -0400
    Re: Question about Pass-by-object-reference? fl <rxjwg98@gmail.com> - 2014-07-22 12:54 -0700
  Re: Question about Pass-by-object-reference? fl <rxjwg98@gmail.com> - 2014-07-22 12:34 -0700
    Re: Question about Pass-by-object-reference? Peter Pearson <ppearson@nowhere.invalid> - 2014-07-22 20:35 +0000
      Re: Question about Pass-by-object-reference? emile <emile@fenx.com> - 2014-07-22 13:46 -0700
        Re: Question about Pass-by-object-reference? fl <rxjwg98@gmail.com> - 2014-07-22 15:17 -0700
          Re: Question about Pass-by-object-reference? Joel Goldstick <joel.goldstick@gmail.com> - 2014-07-22 18:26 -0400
          Re: Question about Pass-by-object-reference? emile <emile@fenx.com> - 2014-07-22 15:33 -0700
          Re: Question about Pass-by-object-reference? Jerry Hill <malaclypse2@gmail.com> - 2014-07-22 19:06 -0400
        Re: Question about Pass-by-object-reference? fl <rxjwg98@gmail.com> - 2014-07-22 15:31 -0700
          Re: Question about Pass-by-object-reference? emile <emile@fenx.com> - 2014-07-22 15:40 -0700
      Re: Question about Pass-by-object-reference? fl <rxjwg98@gmail.com> - 2014-07-22 16:00 -0700
        Re: Question about Pass-by-object-reference? emile <emile@fenx.com> - 2014-07-22 16:10 -0700
  Re: Question about Pass-by-object-reference? Terry Reedy <tjreedy@udel.edu> - 2014-07-22 20:27 -0400
    Re: Question about Pass-by-object-reference? fl <rxjwg98@gmail.com> - 2014-07-22 18:49 -0700
      Re: Question about Pass-by-object-reference? Ben Finney <ben+python@benfinney.id.au> - 2014-07-23 11:59 +1000
        Re: Question about Pass-by-object-reference? Steven D'Aprano <steve@pearwood.info> - 2014-07-23 05:35 +0000
          Re: Question about Pass-by-object-reference? Chris Angelico <rosuav@gmail.com> - 2014-07-23 16:07 +1000
          Re: Question about Pass-by-object-reference? Ben Finney <ben+python@benfinney.id.au> - 2014-07-23 16:25 +1000
          Re: Question about Pass-by-object-reference? Terry Reedy <tjreedy@udel.edu> - 2014-07-23 18:51 -0400
            Re: Question about Pass-by-object-reference? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-07-24 03:22 +0000
              Re: Question about Pass-by-object-reference? Steven D'Aprano <steve@pearwood.info> - 2014-07-24 05:05 +0000
    Re: Question about Pass-by-object-reference? Steven D'Aprano <steve@pearwood.info> - 2014-07-23 05:36 +0000
      Re: Question about Pass-by-object-reference? Terry Reedy <tjreedy@udel.edu> - 2014-07-23 18:32 -0400
    Re: Question about Pass-by-object-reference? alex23 <wuwei23@gmail.com> - 2014-07-25 15:20 +1000
  Re: Question about Pass-by-object-reference? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-07-23 01:56 +0000

csiph-web