You are in a class of your own alone and a single instance that is you, completely inimitable. Thanks for this generosity. I am finally at home with python. I can now sit down and work. God keep blessing you.
This was one of the best videos I found when I pushed myself in programming. I've seen it again and it's still the best video to understand what's going on behind the scenes.
Jones ...your these tutorial video are just on another level.I usually do not comment on social media,but these are the best Python oops video I have watched and grasped so well soo far!Now I am feeling like I can create anything with my codes!Thank you Soo much
I think this is my first comment on youtube. I gave up on couple of other courses as I just cant memorize things until the logic behind sinks in my head. This surely did.., I dont just see the video here, but, how much you have the student's perception. I am learning more than python.. The thought process, teaching skills, visualisation of an idea., creativity. You made my day John Philip Jones !!!
I like how all your videos go slow and you repeat the points of lesson over and over. It really hammers it home. Thanks for all your help and time that you put towards these tutorials. I am learning a lot.
Again thank you. This is the second series of yours I've watched, the other one being on namespaces, and they both have helped me greatly. I know a lot of this stuff, but your videos helped me sharpen my thinking about Python and to get rid of some of my fuzzy thinking.
John, thanks for your thorough explanation on these Python topics. I've found these very helpful with my Python course I am taking in school. I can tell how much effort you've put into creating these for us. Thank you sir!
Great work, i really appreciate it! Thanks for videos like that. Using images, keeping it slow enough and linking it to the ordinary world, this is what makes people understand abstract things!
not usual for me too to comment,but i was great,i likes its simplicity and the way things explained in its tiny pieces of details,so its easy to follow along, and understand the logic and principle. but i wish you make a full course for python video. please thank you...
Breezy Saint Thank you for commenting. I am a firm believer that a visual explanation is always superior to just text. I would like to invite you to join the following community on Python.. plus.google.com/communities/108318057967049881054?partnerid=ogpy0 Regards Phil (John Philip Jones)
Thank you, sir, u nailed it. Your teaching style is 100000000 times better than my college tutor. You deserve millions of subscribers. love from Nepal. #staysafe sir
Thank you check out the following link: www.pythonbytesize.com/ I would be grateful if you shared the link with anybody you think might benefit Best wishes Phil (John Philip Jones)
Hello John, awesome explanation. Helps to understand the basics for the novice & refreshing for intermediate folks. It would be great if you can post similar videos on Python Threading.. Thanks in advance. Great work!!!
excellent explanation, thanks a lot! other videos don't go into details like you do perhaps because they themselves do not understand it as well as you do
Just a question. For example I created a class named MyClass. So, when I assigned it like this (I believe this is called as 'instantiating' the class): class = MyClass() The things happening right here (the concept) is just like in the video? Means that an object is created, labelled as class, and has the attribute ad defined in the MyClass class, and the created objet itself will exists in its own right?
+Hafiz Sofian Yes but make sure you do not use the word class as it is a reserved word. You could use: my_object = MyClass() So my_object is now an object and has all the members declared in MyClass. Other language use the following to created an object: myObject = new MyClass() i.e. they have the addition word new. Regards Phil (John Philip Jones)
John, thank you for creating such a clear and easy-to-understand approach to teaching Python! I wish all programming tutorials were explained in this clearly. Do you teach other programming languages?
+Michael DeGuzman Thank you for your positive comment. I have taught numerous languages C, Java, VB, machine code and Pascal but have only produced videos on Python. I will be moving onto videos on Java when I have finished the series on Python (in about 18 months) Best wishes Phil (John Philip Jones)
OK Mr Jones very good, I would like to ask you about the id that gives a 10 digit number in your example and also gives a 10 digit number when I followed your example using 3.5 python on Windows platform, So the question is this : where is this number pointing to literally (presumably in the execution space that python is using), can I find out what address this is as an address in ram for example ?
+Susan Bruce In CPython according to the official documentation the unique ID is the address of the object. I would advise not to worry about the actual memory address.as the advantage of using a high level language is that the underlining mechanisms are hidden from the programmer. However, my initial profession was as a machine code programmer and I can understand why you would ask this question. I have covered the id function in another video and it can be located at the link below: www.pythonbytesize.com/video-pythons-id-function.html There is also this video: www.pythonbytesize.com/video-pythons-id-function-and-names.html Best wishes Phil (John Philip Jones)
John Philip Jones Thank you for the links. My interest is because my first experience in programing was on the Intel 8080 and the Motorola chip that had relative addressing. 6502 I think, both were 8 bit with 16 bit address bus. So with this encryption program that I am attempting to write; having the equivalent of peek and poke would be very useful.
Susan Bruce I started on the Zilog Z80 and the 6502. Professionally I coded the 6511 a single chip system suitable for embedded systems. It contained the 6511 and input output lines that allowed for connection to ADC and DAC. I used to be an electronics engineer.
John Philip Jones My Dad was a computer engineer, he worked for I.C.L. I think it was called, an American company, he would go round maintaining all sorts of big league hardware, tape storage, disc storage, ferrite memory cores, he even maintained some old valve machines. I got involved when he bought home an old punch hole tape reader/writer, and I would write little programs in BASIC and then punch the tape which he took to work to run and bring home a print out, I was the envy of my school friends, Ha I had forgotten how it was back then in the late Sixties.
Hi John, when we assign same value which is string or integer to two different variable (a = 3 b = 3 or a = 'a' b ='a'), their both memory address is same as you explained your video. But if we assign same float value (a = 1.1 b = 1.1) or same list ( a = [1,2] b= [1,2]) to different variables, their id are different. it is indicating that although their value are same , it is produced different object as opposed to integer and string object. Is there any special reason for it? If so, could you explain? By the way, I always tried to find a mental framework for programming. And only your way of thinking worked out for me. Thanks a lot for your effort and time.
Thank you for your positive comments glad the videos are helping. With respect to your question. The following program: a = 3.142 b = 3.142 print (id(b), id(b)) gave the following output: 46381664 46381664 i.e. the id’s are the same. Also the following program: a = [1,'I am a string',3.1] b = [1,'I am a string',3.1] print (id(b), id(b)) gave the following output: 44889472 44889472 Again the id’s are the same. Best wishes Phil
Both of the descriptions I have used are a model that to some extent hides the details of the underlying mechanisms of the language. The use of the label is the more abstract model. The Object reference is the more concrete model and closer to what goes on under the hood of Python. My recommendation is to have an understanding of both models. Under the hood Python dictionaries 'control' access to the objects using a key/value relationship. Best wishes Phil
Objects encapsulate data and program instructions (i.e. attributes and behaviour(methods)). Encapsulate means grouping the data and instructions together in one entity. A programmer wishing to use the methods of a class only needs to know what methods it offers. The programmer requires no knowledge of the code inside the class (unless they are responsible for writing the class). So a class offers a template of useful behaviours (methods) and attributes (data) and the details of the implementation of the class is hidden. If a programmer wishes to use the methods offered by a class, then they have to create an instance of the class (i.e. an object). The object is then sent messages that invoke the methods inside the object. Now let’s say we have a class that defines a bank account (i.e. it has methods to allow for debiting cash from the account, calculating interest on the account balance, crediting the balance by a deposit etc. - it also has attributes such as the customer’s name, customers balance). At a specific time of a month (i.e. the last day of the month) then within a program loop each bank customer has the interest calculated on their bank balance. There is an object for each customer that, for example, holds their balance. This balance can be altered by a method in the object that calculates the interest and then adds the interest to the balance. There will be as many objects saved on file as there are customers in the bank and each of these objects will have the same methods and attributes but the attributes will contain different values e.g. different value for the balance a different customer name etc. Every integer variable you use in a Python program is based on the integer class and every integer variable is an instance of the integer class (i.e. integer object). Every float variable you use in a Python program is based on the float class and every float variable is an instance of the float class (i.e. float object). Python is built on objects from the base up and as such everything used is essentially an instance of a class (i.e. an object). Returning to the bank customer there needs to be one object for every customer so an object has to exist in its own right one for each customer. If you decided to use a class directly for a customer in code, then it would not be able to hold different values (e.g. different customer names) for each of the customers as there can only be one class for defining the attributes and behaviours of a customer. Remember a class is the template used to define what objects will ‘look like’ and there needs to be one object for each customer i.e. 10,000 customers then 10,000 objects but just one class defining what an object will look like. Regards Phil
My only questions on this outstanding presentation of "Classes" is when you reference "a" as a label tied to or bound to Object. In tkinter there are numerous references to "label" as it relates to tkinter. Is it possible in you example a more accurate reference to "a" in "a = 2" would have been "a" is a variable? Thank you once again and thank you for your help. PS My donations will resume in March.
The term label in the context of the video is to support the model I use to describe objects which is different to the use of label within Tkinter. A Python variable is an object often called an abstract data type. You will also often hear a Python variable referred to as typeless. More precisely a Python variable is typeless but its value does have a type. Best wishes Phil
Really helps visualise some of the structuring of the base classes in Python, in particular putting this documentation: docs.python.org/3/reference/datamodel.html in much more understandable format, as it is difficult when learning OOP to visualise how the builtins are all already class objects
+Joshua Jenkins In programming languages programs can represent Integers and Real numbers. Real numbers can have fractions whereas Integers by definition do not have fractional parts. In some language, such as Visual Basic, a data type called Double is used to represent values that are Real numbers with a certain precision (i.e. as accurately as possible). In Python a float is the data type that can 'store' values that are Real numbers (again as accurately as possible) Phil
in minute 11:33 when varriables a and b using same object, is that mean variable a and variable b on the same memory address / refer to same memory location? thank you for help
Is there a particular sequence in which to view these playlists? After the basic one, I'm looking at which playlist to start on next. I tried this one but it mentions 'ID' and that it's been mentioned in a previous video. Thanks.
+confidential303 Check out the videos at the links below it should clear up why in this case the ID's are the same. But let me know if they do not and I will answer on text. czcams.com/video/rHxC1G03Ck4/video.html czcams.com/video/8nMQX0W4_Bo/video.html Regards Phil
Python is different to many other languages. A variable in Python is a name bound to an instance of a class. The program has an instance of the integer class i.e. the 2. a = 2 creates an instance of the integer class bound to the name 'a' b = 2 binds the name 'b' to the integer instance (2) that already exists. Therefore 'a' and 'b' are bound to the same instance and as a consequence have the same id Best wishes Phil
Thank you so much for the explanation, John. I did some trial and error and you are very correct. After I change the value of b to 2, the id's of a and b equal to each other. a = 2 b = 2 print(id(a)) print(id(b)) print(a is b) # True print(a == b) # True a = b print(f'for a==b {a == b}') print(id(a)) # a has the same id as b print(id(b)) # id for b is unchanged print(a is b) # True print(a == b) # True print(b is a) # True print(b == a) # True I wonder what the advantage is for bounding two different variables to the same instance of a class. My apology as I am fairly new to Python so the answer is probably very obvious. Thanks.
The numbers 2 and 3 are examples of integers and therefore are values that are of type integer which means they are `based` on the integer class. 9.81 is a value with a fractional part and is therefore based on the float class.
Hello John, is execution space = runtime? I cant find your other video on this, do you mind linking me to it?? czcams.com/video/AaIdperUu-A/video.html "we have seen this before"
At the moment I am committed to doing videos on Python but I will be returning to GIMP later in the year. Are there any topics on GIMP that you would like me to cover? Best wishes Phil
I normally don't comment, but this definitely is the best video I have seen so far... Thank you JPJ.
Thank you
Best wishes
Phil
(John Philip Jones)
You are in a class of your own alone and a single instance that is you, completely inimitable. Thanks for this generosity. I am finally at home with python. I can now sit down and work. God keep blessing you.
You are the best tutor on the platform with great indepth explanation and graphics.
This was one of the best videos I found when I pushed myself in programming. I've seen it again and it's still the best video to understand what's going on behind the scenes.
I Like how you explain things normally written in text, as visual images. Its alot better than just memorizing statements.
Jones ...your these tutorial video are just on another level.I usually do not comment on social media,but these are the best Python oops video I have watched and grasped so well soo far!Now I am feeling like I can create anything with my codes!Thank you Soo much
I think this is my first comment on youtube. I gave up on couple of other courses as I just cant memorize things until the logic behind sinks in my head.
This surely did.., I dont just see the video here, but, how much you have the student's perception. I am learning more than python.. The thought process, teaching skills, visualisation of an idea., creativity. You made my day John Philip Jones !!!
Thank you for your positive comments. Glad the videos are helping.
Best wishes
Phil
(John Philip Jones)
That was awesome! This was ripping my brain apart. But your visuals just made everything crystal clear! Thanks!
Excellent presentation and explanation of a fairly complex subject!
Yet another great class, thanks for all the thought, time and effort you put into your online tutorials.
+snamone Thank you for commenting
Best Wishes
Phil
(John Philip Jones)
I like how all your videos go slow and you repeat the points of lesson over and over. It really hammers it home. Thanks for all your help and time that you put towards these tutorials. I am learning a lot.
+Jeremy Kerrigan Glad the videos are helping. Tank you for commenting it is appreciated. Best wishes Phil (John Philip Jones)
John, you are too good! I can't find a better explanation than this anywhere. Very simplified
Good explanation .. Thank Sir
Again thank you. This is the second series of yours I've watched, the other one being on namespaces, and they both have helped me greatly. I know a lot of this stuff, but your videos helped me sharpen my thinking about Python and to get rid of some of my fuzzy thinking.
Great to hear.
Best wishes
Phil
John, thanks for your thorough explanation on these Python topics. I've found these very helpful with my Python course I am taking in school. I can tell how much effort you've put into creating these for us. Thank you sir!
I have not seen such a nice explanation of class and object. Fantastic job. Thanks JPJ.
Your way of explaining OOPS concept in a diagram is Awesome. Thank You.
Thank you for an excellent video. It was easy to follow and interesting . I only wish I had access to this in the 1970's !!!
Great job.
Great work, i really appreciate it! Thanks for videos like that. Using images, keeping it slow enough and linking it to the ordinary world, this is what makes people understand abstract things!
not usual for me too to comment,but i was great,i likes its simplicity and the way things explained in its tiny pieces of details,so its easy to follow along, and understand the logic and principle. but i wish you make a full course for python video. please thank you...
Never commented on any video before but this is so, so good. Best explanation of Classes I've seen.
Very useful for explaining the fundamentals of what can be a difficult topic to a beginner. Thanks you.
Great! You are amazing, mister!
the best video for beginners, step by step well explained
what a gem your lectures are!
Thank You, it was the Best explanations about classes and objects so far I heard from
I'm a visual guy so, your video makes my understanding so much easier, thank you sir!
Breezy Saint Thank you for commenting. I am a firm believer that a visual explanation is always superior to just text. I would like to invite you to join the following community on Python..
plus.google.com/communities/108318057967049881054?partnerid=ogpy0
Regards
Phil
(John Philip Jones)
John Philip Jones Gladly!
Thank you, sir, u nailed it. Your teaching style is 100000000 times better than my college tutor. You deserve millions of subscribers. love from Nepal. #staysafe sir
Thank you for your positive comments it is appreciated.
Best wishes
Phil
Thxxxxx, I am so grateful to see this helpful video
Such good solid coverage of the basics, nice to see.
this is a cracking series of videos, I'm watching it all the way through. Thank you for taking the trouble to do and share them.
Thank you check out the following link:
www.pythonbytesize.com/
I would be grateful if you shared the link with anybody you think might benefit
Best wishes
Phil
(John Philip Jones)
Thank you,
John Philip Jones
The explanation is very definite, it helps me a lot!
this is tantamount to spoon feeding. Well done.
Thanks a lot for a very helpful video, very awesome! This makes the 'object' concept very clear and understandable.
Thank you sir, you are really perfect ❤️.
it's all so clear and the images and graphics really helps. thanks!
Pretty nice explanation, visual diagrams make much more easier to understand and keep data on my head :) congratulations for a fantastic work
Hello Daniel,
Thank you for your generous comment.
Best wishes
Phil
(John Philip Jones)
Thanks for the video. I can use it as a add-on tool for teaching it to my students who are visual learners.
perfect for visual learners
That s the most clear lesson I saw, Thx.
Could you pls tell me what animation software you are using to create these lessons? Thank you.
Wao amazing.. Lots of love ... thanks allot..
Great video! Very helpful. Thank you.
Hello John, awesome explanation. Helps to understand the basics for the novice & refreshing for intermediate folks. It would be great if you can post similar videos on Python Threading.. Thanks in advance. Great work!!!
Prem Anand Thank you. I will be covering threading soon maybe two or three months
Phil
Great Work sir..........!
+anil Pathapati Thank you
Regards
Phi;
(John Philip Jones)
U r teaching was excellent,,,we expect more videos from u😍
Very helpful video. Thanks for such clear explanation of it :)
I thought Corey Schafer was good, but these videos are way better!
This video give me more than I needed. Thanks!
+Hafiz Sofian Glad it helped thank you for commenting.
Best wishes
Phil
(John Philip Jones)
Really helpful to understand the concept of class.
Thank you for commenting
Best Wishes
Phil
Yes, I quite agree. Whereas before I had some nebulous understanding of the concept, I now _grok_ it :)
Clearly, Mr. Jones has a gift for teaching.
Wayne Phillips Thank you for your generous comment
Best wishes
Phil
(John Philip Jones)
excellent explanation, thanks a lot! other videos don't go into details like you do perhaps because they themselves do not understand it as well as you do
Thank you for your positive comments. They are appreciated.
Best wishes
Phil
(John Philip Jones)
Great work , thank you !
Just a question. For example I created a class named MyClass. So, when I assigned it like this (I believe this is called as 'instantiating' the class):
class = MyClass()
The things happening right here (the concept) is just like in the video? Means that an object is created, labelled as class, and has the attribute ad defined in the MyClass class, and the created objet itself will exists in its own right?
+Hafiz Sofian Yes but make sure you do not use the word class as it is a reserved word. You could use:
my_object = MyClass()
So my_object is now an object and has all the members declared in MyClass.
Other language use the following to created an object:
myObject = new MyClass() i.e. they have the addition word new.
Regards
Phil
(John Philip Jones)
+John Philip Jones Thanks! This really clear things up for me.
Really Really nice and thanks for!
nice video Excellant
John, thank you for creating such a clear and easy-to-understand approach to teaching Python! I wish all programming tutorials were explained in this clearly. Do you teach other programming languages?
+Michael DeGuzman Thank you for your positive comment. I have taught numerous languages C, Java, VB, machine code and Pascal but have only produced videos on Python. I will be moving onto videos on Java when I have finished the series on Python (in about 18 months)
Best wishes
Phil
(John Philip Jones)
Thanks a lot.This was awesome
Very good explanation
Thank you check out the supporting website for these videos on Python
www.pythonbytesize.com/
Best wishes
Phil
Who else came here from the link Jamie posted on the" 100 Days of Code: The Complete Python Pro Bootcamp" Q&A😂
OK Mr Jones very good, I would like to ask you about the id that gives a 10 digit number in your example and also gives a 10 digit number when I followed your example using 3.5 python on Windows platform, So the question is this : where is this number pointing to literally (presumably in the execution space that python is using), can I find out what address this is as an address in ram for example ?
+Susan Bruce In CPython according to the official documentation the unique ID is the address of the object. I would advise not to worry about the actual memory address.as the advantage of using a high level language is that the underlining mechanisms are hidden from the programmer. However, my initial profession was as a machine code programmer and I can understand why you would ask this question. I have covered the id function in another video and it can be located at the link below:
www.pythonbytesize.com/video-pythons-id-function.html
There is also this video:
www.pythonbytesize.com/video-pythons-id-function-and-names.html
Best wishes
Phil
(John Philip Jones)
John Philip Jones Thank you for the links.
My interest is because my first experience in programing was on the Intel 8080 and the Motorola chip that had relative addressing.
6502 I think, both were 8 bit with 16 bit address bus.
So with this encryption program that I am attempting to write; having the equivalent of peek and poke would be very useful.
Susan Bruce I started on the Zilog Z80 and the 6502. Professionally I coded the 6511 a single chip system suitable for embedded systems. It contained the 6511 and input output lines that allowed for connection to ADC and DAC. I used to be an electronics engineer.
John Philip Jones My Dad was a computer engineer, he worked for I.C.L. I think it was called, an American company, he would go round maintaining all sorts of big league hardware, tape storage, disc storage, ferrite memory cores, he even maintained some old valve machines.
I got involved when he bought home an old punch hole tape reader/writer, and I would write little programs in BASIC and then punch the tape which he took to work to run and bring home a print out, I was the envy of my school friends, Ha I had forgotten how it was back then in the late Sixties.
Hi John, when we assign same value which is string or integer to two different variable (a = 3 b = 3 or a = 'a'
b ='a'), their both memory address is same as you explained your video. But if we assign same float value (a = 1.1 b = 1.1) or same list ( a = [1,2] b= [1,2]) to different variables, their id are different. it is indicating that although their value are same , it is produced different object as opposed to integer and string object.
Is there any special reason for it? If so, could you explain?
By the way, I always tried to find a mental framework for programming. And only your way of thinking worked out for me. Thanks a lot for your effort and time.
Thank you for your positive comments glad the videos are helping.
With respect to your question. The following program:
a = 3.142
b = 3.142
print (id(b), id(b))
gave the following output:
46381664 46381664
i.e. the id’s are the same.
Also the following program:
a = [1,'I am a string',3.1]
b = [1,'I am a string',3.1]
print (id(b), id(b))
gave the following output:
44889472 44889472
Again the id’s are the same.
Best wishes
Phil
In your earlier videos "Pythons Object Reference" you showed arrow for variable and its refers to object,is it a reference or labelled?
Both of the descriptions I have used are a model that to some extent hides the details of the underlying mechanisms of the language. The use of the label is the more abstract model. The Object reference is the more concrete model and closer to what goes on under the hood of Python. My recommendation is to have an understanding of both models. Under the hood Python dictionaries 'control' access to the objects using a key/value relationship. Best wishes Phil
Hi john great video, What is the relevance of the object existing in its own right?
Objects encapsulate data and program instructions (i.e. attributes and behaviour(methods)). Encapsulate means grouping the data and instructions together in one entity. A programmer wishing to use the methods of a class only needs to know what methods it offers. The programmer requires no knowledge of the code inside the class (unless they are responsible for writing the class). So a class offers a template of useful behaviours (methods) and attributes (data) and the details of the implementation of the class is hidden. If a programmer wishes to use the methods offered by a class, then they have to create an instance of the class (i.e. an object). The object is then sent messages that invoke the methods inside the object.
Now let’s say we have a class that defines a bank account (i.e. it has methods to allow for debiting cash from the account, calculating interest on the account balance, crediting the balance by a deposit etc. - it also has attributes such as the customer’s name, customers balance). At a specific time of a month (i.e. the last day of the month) then within a program loop each bank customer has the interest calculated on their bank balance. There is an object for each customer that, for example, holds their balance. This balance can be altered by a method in the object that calculates the interest and then adds the interest to the balance. There will be as many objects saved on file as there are customers in the bank and each of these objects will have the same methods and attributes but the attributes will contain different values e.g. different value for the balance a different customer name etc.
Every integer variable you use in a Python program is based on the integer class and every integer variable is an instance of the integer class (i.e. integer object). Every float variable you use in a Python program is based on the float class and every float variable is an instance of the float class (i.e. float object). Python is built on objects from the base up and as such everything used is essentially an instance of a class (i.e. an object).
Returning to the bank customer there needs to be one object for every customer so an object has to exist in its own right one for each customer. If you decided to use a class directly for a customer in code, then it would not be able to hold different values (e.g. different customer names) for each of the customers as there can only be one class for defining the attributes and behaviours of a customer. Remember a class is the template used to define what objects will ‘look like’ and there needs to be one object for each customer i.e. 10,000 customers then 10,000 objects but just one class defining what an object will look like.
Regards
Phil
very good work! 3Q
My only questions on this outstanding presentation of "Classes" is when you reference "a" as a label tied to or bound to Object. In tkinter there are numerous references to "label" as it relates to tkinter. Is it possible in you example a more accurate reference to "a" in "a = 2" would have been "a" is a variable? Thank you once again and thank you for your help.
PS
My donations will resume in March.
The term label in the context of the video is to support the model I use to describe objects which is different to the use of label within Tkinter. A Python variable is an object often called an abstract data type. You will also often hear a Python variable referred to as typeless. More precisely a Python variable is typeless but its value does have a type.
Best wishes
Phil
Thank you Phil.
Really helps visualise some of the structuring of the base classes in Python, in particular putting this documentation: docs.python.org/3/reference/datamodel.html
in much more understandable format, as it is difficult when learning OOP to visualise how the builtins are all already class objects
Great video. Why doesn't python use double instead of float?
+Joshua Jenkins In programming languages programs can represent Integers and Real numbers.
Real numbers can have fractions whereas Integers by definition do not have fractional parts. In some language, such as Visual Basic, a data type called Double is used to represent values that are Real numbers with a certain precision (i.e. as accurately as possible). In Python a float is the data type that can 'store' values that are Real numbers (again as accurately as possible)
Phil
in minute 11:33 when varriables a and b using same object, is that mean variable a and variable b on the same memory address / refer to same memory location?
thank you for help
a and b refer to the same object. Objects are kept in dictionaries so a and b refer to the same object in the dictionary.
Is there a particular sequence in which to view these playlists? After the basic one, I'm looking at which playlist to start on next. I tried this one but it mentions 'ID' and that it's been mentioned in a previous video. Thanks.
I would recommend you view the videos in the order shown on the following page.
www.pythonbytesize.com/video-list-website.html
Regards
Phil
Thanks John....
Thank you so much
at 12:05 variable a and b shares the same ID, shouldn't ID be unique regardless of the value it will contain?
+confidential303 Check out the videos at the links below it should clear up why in this case the ID's are the same. But let me know if they do not and I will answer on text.
czcams.com/video/rHxC1G03Ck4/video.html
czcams.com/video/8nMQX0W4_Bo/video.html
Regards
Phil
thanks john
thanks you so much
Excellent
+Stephen O'Brien Thank you
Best wishes
Phil
(John Philip Jones)
for the second line in the code @ (11:26), should it be b = a instead of b = 2 in order for b to have the same ID as a?
Python is different to many other languages. A variable in Python is a name bound to an instance of a class. The program has an instance of the integer class i.e. the 2.
a = 2 creates an instance of the integer class bound to the name 'a'
b = 2 binds the name 'b' to the integer instance (2) that already exists.
Therefore 'a' and 'b' are bound to the same instance and as a consequence have the same id
Best wishes
Phil
Thank you so much for the explanation, John. I did some trial and error and you are very correct. After I change the value of b to 2, the id's of a and b equal to each other.
a = 2
b = 2
print(id(a))
print(id(b))
print(a is b) # True
print(a == b) # True
a = b
print(f'for a==b {a == b}')
print(id(a)) # a has the same id as b
print(id(b)) # id for b is unchanged
print(a is b) # True
print(a == b) # True
print(b is a) # True
print(b == a) # True
I wonder what the advantage is for bounding two different variables to the same instance of a class. My apology as I am fairly new to Python so the answer is probably very obvious. Thanks.
Takes less room in memory. Best wishes Phil
thanks this is right.but one thing why is A=2 and B=3 called "integer class",and why A=9.81 is called "float class"???? please.
The numbers 2 and 3 are examples of integers and therefore are values that are of type integer which means they are `based` on the integer class. 9.81 is a value with a fractional part and is therefore based on the float class.
thanks again Mr.
Thank you ! Does this apply to 2.7 too?
boris runakov Hello Boris, Yes it applies to other versions of Python.
Best wishes
Phil
(John Philip Jones)
John Philip Jones - except in python 2... the output of type(...) shows '
Thanks for the input !
amazing!subscribe for you :D
It's great, from china.
Which one is the previous video?
+Ben .Lu The previous video is at the following link:
www.pythonbytesize.com/video-pythons-id-function-and-names.html
Regards
Phil
how do I get the id of a letter in the string?
Use the id() function and pass in the string name with the index position of the character position you wish to know about.
Best wishes Phil
Hello John, is execution space = runtime? I cant find your other video on this, do you mind linking me to it??
czcams.com/video/AaIdperUu-A/video.html "we have seen this before"
found it in a later video in this playlist: czcams.com/video/kZnaFP9U9nY/video.html
See the video at the following link:
www.pythonbytesize.com/114-video-a-python-variable-versus-a-python-object.html
Best wishes Phil
Can you do more gimp?
Because your tutorials are great ;) you explain very Well, and it is easy to Pick up :)
At the moment I am committed to doing videos on Python but I will be returning to GIMP later in the year. Are there any topics on GIMP that you would like me to cover? Best wishes
Phil
Ezzeddin Høgden Thank you Best wishes Phil