<html><head></head><body><br>
<br>
Hans Nowak wrote:<br>
<blockquote type="cite" cite="mid:3B9EC544@twigger.nl">
  <blockquote type="cite"><pre wrap="">===== Original Message From "Matthew D. Wood" <a class="moz-txt-link-rfc2396E" href="mailto:woodm@equire.com"><woodm@equire.com></a> =====<br>Ok, I've been banging my head against this for a sufficiently long time<br>that I feel justified in presenting this personal challenge to the list.<br><br>How do you make a swap function?<br></pre></blockquote>
    <pre wrap=""><!----><br>You don't need to. :)  Use:<br><br>  a, b = b, a<br></pre>
    </blockquote>
That makes me so mad that I didn't think of that.  Great suggestion.  (I feel really dumb...)<br>
    <br>
    <blockquote type="cite" cite="mid:3B9EC544@twigger.nl"><pre wrap=""><br></pre>
      <blockquote type="cite"><pre wrap="">How do you make a function or a callable object instance that will do<br>what the following code intends to do:<br><br>  def swap (heaven, hell) :<br>          purgatory = heaven<br>          heaven = hell<br>          hell = purgatory<br></pre></blockquote>
        <pre wrap=""><!----><br>Python's internal workings are very different from languages like C and <br>Pascal. A Python "variable" is not a location in memory that you can fill with <br>arbitrary data. This Pascal code:<br><br>  X := 3;<br>  X := 42;<br><br>changes the value of X, which resides at a certain location in memory. But the <br>equivalent Python code<br><br>  x = 3<br>  x = 42<br><br>does not do exactly the same; rather, it binds the name 'x' to the value 3, <br>then rebinds that name to the value 42. Other people explain this better than <br>me; see<br><br>  <a class="moz-txt-link-freetext" href="http://w1.132.telia.com/~u13212494/guides/python-objects.htm">http://w1.132.telia.com/~u13212494/guides/python-objects.htm</a><br><br>HTH,<br><br>--Hans Nowak<br><br><br></pre>
        </blockquote>
Yeah, from what I have found, the best way to think about things is that
everything is a reference.  However, you can't affect the value of a passed
parameter.  You can however, effect the contents of that reference.  (You
can't point to a different list, but you can screw with the contents of the
current list.)  I just couldn't figure out how to get around that problem.<br>
        <br>
        <br>
But thanks to you, I can.  I love this list!
        <blockquote type="cite" cite="mid:3B9EC544@twigger.nl"><pre wrap=""></pre>
          </blockquote>
</body></html>