Pass by reference ?

Robert W. Cunningham rcunning at
Wed Apr 5 22:15:44 EDT 2000

Justin Sheehy wrote:

> The line:
>   w=None
> simply makes the local variable `w' no longer be bound to the argument
> passed, but rather to None.  Reassigning the name `w' is simply that:
> reassigning a name.  Whatever was previously referred to by that name
> is irrelevant.

Doh!  That's what I get for trying to play with a new language at
midnight.  I *knew* the effect of assigning None.  Maybe I should have used
"del" instead?

Evidently I'm at the stage where I know enough to be truly dangerous.  I'll
take a moment to become a bit more fluent and have another go at this
later.  Of all the examples that could have dropped out of my mind, that's
the one I had to type in.  <sigh>

I have better examples at hand, but I wanted to write my own.  Hoping, of
course, that I'd learn something in the process.  As the Chinese would
say:  "Be careful what you ask for..."


More information about the Python-list mailing list