Little help with exercise 41

yes this terms are now very clear

i think as i continue this book this thing will become clear

yes i am bit focusing on theory and terms because without knowing what is happening behind the scene does not giving me confidence to practice EX41 and to move on with book
i think what was main obstacle is confusion between instance and object which is now clear
can you do me a one last favor
read this post in which i asked question about calling a class by two different ways

Hello @divyang_patel.

Check out this and other videos from this guy. John Philip Jones
It helped me much when I first tried to understand classes.

1 Like

I know you want to get all the theory language down, but honest, go play with the code so you can see it in action…
The first version is assigning that class, my blueprint to ‘foo’. It is not an instance – active usable copy of the class.
The second version is the instance being assigned to ‘foo’.

  1. Make a simple class with simple attributes.
  2. Try to get those values of those attributes and print them.
  3. Try to assign new values to those attributes of that simple class.
    Look at your results…
    Then:
  4. Make an instance of that simple classs
  5. repeat steps 1 - 3.

there are class’s in the python language we use all the time without knowing it.
what would happen if someone could accidently or purposely change the class code?
This is a big reason the only way to use a class is to have an active copy of it, and NOT the class (and it’s original code) itself.

1 Like

oh so
in first version init does not run so instance is not created and zed said that self is a variable for the instance/object being accessed so there is no instance/object so self is not going to refer anything so that’s why we can’t access K
in second version instance is created and assigned to foo so self can refer to object foo so we can access K

yes i’m going to make some and practice this

1 Like

All the theory in the human realm can’t replace experience.
You got this.

1 Like