changing a value of a variable

Aahz Maruch aahz at panix.com
Wed Jan 30 10:47:22 EST 2002


In article <Xns91A65CBF59497duncanrcpcouk at 127.0.0.1>,
Duncan Booth  <duncan at rcp.co.uk> wrote:
>"Delaney, Timothy" <tdelaney at avaya.com> wrote in
>news:mailman.1012351557.24255.python-list at python.org: 
>>
>> The normal method is to rebind the return value of the function to the
>> name (in this case, 'n'). The above links will let you understand what
>> the previous sentence means.
> 
>It is interesting to note that the Pythonic way of doing things (explicitly 
>assigning the result to the variables you are changing) makes it far less 
>likely that you will make the kind of mistake the original poster made 
>where the & was missed out.
>Thank goodness for Python.
>
>Before anyone quibbles saying that the compiler would have caught the 
>missing &: I have seen C programmers put a cast in to suppress the error 
>when the compiler complained about the wrong level of indirection and then 
>wonder why they get really obscure crashes.

Yes.  That's precisely why I was quibbling with the original post.

(As I said, I'm not a C programmer, but I know enough C and programming
that I've written working cross-platform DLLs.)
-- 
                      --- Aahz  <*>  (Copyright 2002 by aahz at pobox.com)

Hugs and backrubs -- I break Rule 6                 http://www.rahul.net/aahz/
Androgynous poly kinky vanilla queer het Pythonista   

"I got the new SPORT-UTILITY Segway."  --Tom Toles



More information about the Python-list mailing list