Python Objects, Garbage Collection, and Name Binding Programming Examples

Published: 27 August 2021
on channel: Appficial
681
12

Python uses objects to represent everything in your program, such as strings, integers, functions, lists and more.

Objects have 3 properties:
1. Value – Ex: 20, “twenty”, or “20”
2. Type – The object’s type: Integer, string, floating-point, etc.
3. Identity – the identifier name that describes the object

The Python interpreter creates and uses objects as needed to run your code. When an object is no longer used, garbage collection deletes it from memory.

Names are associated to objects via name binding. An object can have one or more name bound to it, and a name is bound to exactly one object. In Python, there are no declarations. The existence of a variable depends on a statement that binds the variable, or, in other words, that sets a name to hold a reference to some object. You can also unbind a variable by resetting the name so it no longer holds a reference.

The type() function returns the type of an object. The type of the object determines if it is mutable (changeable) or immutable (unchangeable). In python, both strings and integers are mutable

The id() function gives the value of an object's identity.

Subscribe to Appficial for more programming videos coming soon. Also, don't forget to click LIKE and comment on the video if it helped you out!


On this page of the site you can watch the video online Python Objects, Garbage Collection, and Name Binding Programming Examples with a duration of hours minute second in good quality, which was uploaded by the user Appficial 27 August 2021, share the link with friends and acquaintances, this video has already been watched 681 times on youtube and it was liked by 12 viewers. Enjoy your viewing!