> Hi
>
> I was trying to learn about classes in Python and have been playing
> around but I am having a problem with the deepcopy function. I want to
> have a function that returns a clean copy of an object that you can
> change without it changing the original, but no matter what I do the
> origin
Michael wrote:
> Okay
>
> Just when I think I am getting it you throw this in.
You're welcome.
> So why does a become local to each variable but b seem global?
>
A better way to ask that is "why does a become an instance property but
b remain a class property?"
f.a = 3
This is an assignment
Okay
Just when I think I am getting it you throw this in. So why does a
become local to each variable but b seem global?
Michael
bob gailer wrote:
> Michael wrote:
>> Hi Michael
>>
>> Thanks for the quick reply, I think I get it. So becuase I did not
>> declare them withing the init method usi
Michael wrote:
> Hi Michael
>
> Thanks for the quick reply, I think I get it. So becuase I did not
> declare them withing the init method using self they are shared by every
> object that is created, even completely brand new ones?
>
> Is it normal practice to declare your variables in a class? I
"Michael" <[EMAIL PROTECTED]> wrote
> Is it normal practice to declare your variables in a class? I notice
> that you don't have to, you can create them as you go, but i thought
> declaring and initialising them in the class would make it easier to
> understand and see what the class is for and s
Hi Michael
Thanks for the quick reply, I think I get it. So becuase I did not
declare them withing the init method using self they are shared by every
object that is created, even completely brand new ones?
Is it normal practice to declare your variables in a class? I notice
that you don't hav
Hi Michael,
This is a very interesting example. You do indeed have two distinct
copies. The interdependence you are observing is because you have
defined CLASS-LEVEL variables (akin to static in Java) rather than
instance-level variables. This is because of their declaration
within th
Hi
I was trying to learn about classes in Python and have been playing
around but I am having a problem with the deepcopy function. I want to
have a function that returns a clean copy of an object that you can
change without it changing the original, but no matter what I do the
original change