Re: Confused yet again: Very Newbie Question

2008-07-08 Thread Lie
On Jul 7, 7:09 pm, Jeff <[EMAIL PROTECTED]> wrote: > When you call c3.createJoe(c1.fred), you are passing a copy of the > value stored in c1.fred to your function.  Python passes function > parameters by value. No, python doesn't pass variable either by value or by reference. The behavior in pytho

Re: Confused yet again: Very Newbie Question

2008-07-07 Thread Terry Reedy
Jeff wrote: When you call c3.createJoe(c1.fred), you are passing a copy of the value stored in c1.fred to your function. Python passes function parameters by value. These statements are both wrong. Function argument objects or objects derived therefrom are bound to function parameter names

Re: Confused yet again: Very Newbie Question

2008-07-07 Thread mcl
On Jul 7, 5:07 pm, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Mon, 7 Jul 2008 05:41:22 -0700 (PDT), mcl <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > > My use of classes is because I want two classes one for  global > > variables and one for global functions. > >    

Re: Confused yet again: Very Newbie Question

2008-07-07 Thread Matt Nordhoff
Jerry Hill wrote: > On Mon, Jul 7, 2008 at 7:30 AM, mcl <[EMAIL PROTECTED]> wrote: >> I did not think you had to make the distinction between 'byvar' and >> 'byref' as in Basic. > > Python does not use "call by value" or "call by reference" semantics. > Instead, python's model is "call by object".

Re: Confused yet again: Very Newbie Question

2008-07-07 Thread Peter Pearson
On Mon, 7 Jul 2008 05:41:22 -0700 (PDT), mcl <[EMAIL PROTECTED]> wrote: [snip] > My use of classes is because I want two classes one for global > variables and one for global functions. One of the many lovely things about programming in the Python style is that very few things need to be global.

Re: Confused yet again: Very Newbie Question

2008-07-07 Thread Jerry Hill
On Mon, Jul 7, 2008 at 7:30 AM, mcl <[EMAIL PROTECTED]> wrote: > I did not think you had to make the distinction between 'byvar' and > 'byref' as in Basic. Python does not use "call by value" or "call by reference" semantics. Instead, python's model is "call by object". See this writeup for some

Re: Confused yet again: Very Newbie Question

2008-07-07 Thread Matt Nordhoff
mcl wrote: > On 7 Jul, 13:09, Jeff <[EMAIL PROTECTED]> wrote: >> When you call c3.createJoe(c1.fred), you are passing a copy of the >> value stored in c1.fred to your function. Python passes function >> parameters by value. The function will not destructively modify its >> arguments; you must exp

Re: Confused yet again: Very Newbie Question

2008-07-07 Thread mcl
On 7 Jul, 13:09, Jeff <[EMAIL PROTECTED]> wrote: > When you call c3.createJoe(c1.fred), you are passing a copy of the > value stored in c1.fred to your function.  Python passes function > parameters by value.  The function will not destructively modify its > arguments; you must expliticly state you

Re: Confused yet again: Very Newbie Question

2008-07-07 Thread Jeff
When you call c3.createJoe(c1.fred), you are passing a copy of the value stored in c1.fred to your function. Python passes function parameters by value. The function will not destructively modify its arguments; you must expliticly state your intention to modify an object: class one(): fred =

Re: Confused yet again: Very Newbie Question

2008-07-07 Thread Matt Nordhoff
mcl wrote: > Why can I not the change the value of a variable in another class, > when I have passed it via a parameter list. > > I am sure I am being stupid, but I thought passed objects were Read/ > Write In Python, there are names which are bound to objects. Doing "foo = bar" and then "foo = s

Confused yet again: Very Newbie Question

2008-07-07 Thread mcl
Why can I not the change the value of a variable in another class, when I have passed it via a parameter list. I am sure I am being stupid, but I thought passed objects were Read/ Write eg #!/usr/bin/python class one(): #my Global Var