Python an Immutable Object

Sdílet
Vložit
  • čas přidán 28. 08. 2024
  • Describes the immutable nature of an integer object and introduces garbage collection.

Komentáře • 24

  • @Harish-ou4dy
    @Harish-ou4dy Před 4 lety +5

    this channel deserves more subscribers.

  • @anurasenarathna1703
    @anurasenarathna1703 Před 2 lety +1

    A very clear explanation of Garbage collection. Thank you

  • @maya11537
    @maya11537 Před 4 lety +2

    I do not know how to thank you for your videos, they are so useful and your explanation is very clear, and I am very happy to be your subscriber :)

    • @johnphilipjones
      @johnphilipjones  Před 3 lety

      Thank you for your positive feedback it is appreciated. It is very pleasing to know the videos are helpful.
      Best wishes
      Phil

  • @sadipiralabasireddy5141
    @sadipiralabasireddy5141 Před 3 lety +2

    What an wonderful explantion, Mr JPJ, Thanks a lot!

  • @sols2006
    @sols2006 Před 7 lety +3

    Awesome Explanation Thanks!!!

  • @asmartbajan
    @asmartbajan Před 9 lety

    Wow! Things are _now_ getting interesting :)

  • @borisrunakov1662
    @borisrunakov1662 Před 9 lety +1

    Very informative ! Thank you !

    • @johnphilipjones
      @johnphilipjones  Před 9 lety

      boris runakov Thank you for commenting
      Best wishes
      Phil
      (John Philip Jones)

    • @borisrunakov1662
      @borisrunakov1662 Před 9 lety

      John Philip Jones One question : when you first_number = 2 , then first_number points to an object with value 2 . But how does python know that the object with value 2 is an integer object type . Does this object point to an int object ? How is this implemented?

    • @johnphilipjones
      @johnphilipjones  Před 9 lety +1

      boris runakov
      When the object is created it has a number of attributes. One of these attributes will be its type. In other words the object (which is an instance of a class) holds information on itself. Have a look at the following videos:
      czcams.com/video/DIvTNr_eQrY/video.html
      czcams.com/video/AaIdperUu-A/video.html
      Regards
      Phil
      (John Philip Jones)

  • @sreejareddygummi4900
    @sreejareddygummi4900 Před 4 lety +1

    This happened same with the lists also.After changing the value of one of the variables in list,it changes its id after assigning another,so can we say lists are immutable?

    • @johnphilipjones
      @johnphilipjones  Před 4 lety +1

      Lists are mutable because the list content can be changed. The ID of the list will not change when you alter one element of a list. However the ID of an element will change if for example it is storing an integer object. Best wishes Phil

  • @redberries8039
    @redberries8039 Před 6 lety +1

    ....that was great

  • @sonyou9211
    @sonyou9211 Před 9 lety +1

    Really good Videos. Is there anywhere one can download all the slides ? This would really help remember so of these concepts. The idea is to store them and recall them in ones memory to make the understanding of these concepts solid in memory.

    • @johnphilipjones
      @johnphilipjones  Před 9 lety +3

      Sonal Patel Once the video series is finished (12 to 18 months) I will be putting the slides into a suitable format and uploading to my website. Best wishes Phil

  • @confidential303
    @confidential303 Před 8 lety

    Is the garbage collection algorithm also used for harddisks as well? I heard the data on your harddisk is not deleted actually pointers are deleted pointing to the data, that is why , it is possible to retrieve deleted items.

    • @johnphilipjones
      @johnphilipjones  Před 8 lety +2

      +confidential303 The operating system controls the disc. The Python program makes a 'connection' to the disc via the operating system. Python sets aside resources to achieve this 'connection' and the resources have to be released when Python has finished with the disc to ensure the program is efficient.
      When you delete a file from the disc it remains there until the space it occupies is needed to store other files. When you delete a file you delete an entry in a table that indicated the physical address of the file on the disc you do not delete the magnetic areas on the disc representing the data in the file. But the area they occupy will be eventually overwritten as other files are copied to the disc.
      Regards
      Phil

  • @elliulla
    @elliulla Před 3 lety

    And what happens if again I reassign first_number=2? Is another new object created or is the variable reassigned to the first object?

    • @johnphilipjones
      @johnphilipjones  Před 3 lety +1

      a = 2
      print(a,id(a))
      b = 2
      print(b,id(b))
      a = 2
      print(a,id(a))
      the above code gives:
      2 140714678552256
      2 140714678552256
      2 140714678552256
      >>>
      Each line shows the value of the variable, followed by the id the variable.
      Note the value and id is the same.
      Best wishes
      Phil

  • @newname958
    @newname958 Před 8 lety

    Is there any way to figure out whether a particular datatype is immutable or not.

    • @johnphilipjones
      @johnphilipjones  Před 8 lety

      +Kandan Siva Assign a value to a variable and print its id. Assign the same variable and print its id. If the id's are different then the variable is immutable.
      Regards
      Phil
      (John Philip Jones)

    • @newname958
      @newname958 Před 8 lety

      +John Philip Jones Thanks

  • @rayapupurushotham6139
    @rayapupurushotham6139 Před 7 lety

    My search ends here.Than Q very much john philip jones....Will u please give me programs for FACTORIAL AND FOR FIBONACCI SERIES.......Please john and thanks in advance