Extremely well explained! It was a bit confusing in the pepsi example but the programming example made it all clear.
@Xartab5 жыл бұрын
I had no idea lists would behave like that, that's really important to keep in mind when assigning variables!
@scarletdcruz78435 жыл бұрын
Are you writing a book? Cause I'd buy it.
@rsrazorfen5 жыл бұрын
Hi Corey, I've been watching many of your videos (especially the flask-tutorial) and just wanted to thank you. Those videos basically got me started with python and helped me not only for my personal coding but also for my job. You're doing an amazing work - keep it up man, much love from Germany!
@umaraftab60735 жыл бұрын
I just watched your video on Unit Testing and wished to have you upload the next one. And, then here it is. :)
@Gaspar.Albertengo5 жыл бұрын
Excellent. Would be nice to see how "is" interacts with "not", "in", ect.
@nythepegasus4 жыл бұрын
I know this is a very old comment, but you cannot use is with in, it throws a SyntaxError. “is not” gives a SyntaxWarning asking if you meant “!=“
@lukebircharchive38334 жыл бұрын
@@nythepegasus The syntax warning is because you probably should've used "!=" or not "==" in that case instead of "is not". If you type in "2 is 3", it would probably show you the same warning.
@TexasGunDude5 жыл бұрын
You just got a new Patreon supporter.
@coreyms5 жыл бұрын
Thanks!!
@PandhuW8 ай бұрын
I like your explanation. I also like your pandas tutorial video. Btw, I saw this in a book a = [1, 2, 3] c = list(a) a == c >>> True a is c >>> False
@leondaz5 жыл бұрын
I love you man, really thanks, I came to the newest video you posted just to thank you for everything, I hope you see this
@karimkohel32405 жыл бұрын
this is the best type of content please keep educating us like that
@Ghasakable5 жыл бұрын
Man we missed you so much!!, I
@scotttct5 жыл бұрын
I am taking a course on Python and this was very helpful to see how and why the == and is comparisons are used in code. Thanks!
@zakariyaabubakar62985 жыл бұрын
Thanks Corey. Your a gifted teacher
@UrstrulyPrathap5 жыл бұрын
Thank you so much sir..... finally I got Python developer job ❤️ ..only because of your tutorials❤️
@nicoTheGreatswordUser5 жыл бұрын
How did u start in python
@coreyms5 жыл бұрын
Congrats!
@poke_champ5 жыл бұрын
Corey Schafer uploads *[EVERYBODY LIKE THAT]*
@SeaTaj3 жыл бұрын
Thank you. Great content as usual. Is it weird that I'm binging your content?
@ulfgj3 жыл бұрын
@3:46 - now how did u space out that list so nicely? shortcut?
@nehat7865 жыл бұрын
thank god you came back
@aashayamballi5 жыл бұрын
Thanks Corey 😊
@rainbowskeppy52923 жыл бұрын
3:55 you could just write print(l1 == l2)
@rodwanbakkar25124 жыл бұрын
I like your videos before watching them
@glorytoarstotzka3305 жыл бұрын
4:15 question : could you also do "print(l1 == l2)" instead of "if l1 == l2: print(True) else: print(False)" ? . Edit: I see that at the end of the video you've done this , so my question has been answered
@coreyms5 жыл бұрын
Yes. I just did it with the conditional at first so that it was more clear what was going on.
@davidm.johnston89945 жыл бұрын
Thank you for this video Corey!
@cati41425 жыл бұрын
I really love your work! Thank you so much for your videos! Will you publish something about statistics with python? hypothese testing, linear regression or something? Would be sooo great
@lethanhtu1255 жыл бұрын
Your video really easy to understand
@leondaz5 жыл бұрын
I understand them perfectly because I made a project using them, but I still like if corey explains them, cause 100% I'll learn something new
@LuisSanchezLouieLouie4 жыл бұрын
Great example man. thanks
@changanzhang31245 жыл бұрын
Corey you're awesome! How do you actually learn all these....and explain them in such a simple manner...and make these videos open source. Thanks!
@nathantum84635 жыл бұрын
I think he should make a video on how he learns all the new stuff.
@khalidhassani61735 жыл бұрын
KZbin has got a talent is Schafer
@NomadLovesUs Жыл бұрын
Clear and concise, thank you!
@fredwooten145 жыл бұрын
Thanks Corey, Great video!
@rounakghosh6213 Жыл бұрын
Awesome, thanks for the clear explanation..
@davidcarter89324 жыл бұрын
Your videos are exceptional. I enjoy them all. In this one it would help to expand a little on when to use "is" or ==. Linter seems to want me to use "is" in logical comparisons, but doesn't complain about == in other comparisons. So, should we use "value is True" and "x == y"? "Value is True" seems to work, but I don't trust it based upon your description about having identical memory locations. Are True and False assigned fixed memory locations and logical variables assigned one of those two memory locations? Since I don't know the answer, I am inclined to always use == which may not be pretty, but it works. What do you think?
@ulfgj5 жыл бұрын
corey, whats the color theme for sublime you are using here? it's so smoooth.
@coreyms5 жыл бұрын
Predawn
@rajath19645 жыл бұрын
@@coreyms how to comment multiple lines at once using '#' (single line comment), i see many youtubers do that but just cant figure it out. like what i mean is : use # to comment multiple selected /highlighted lines with single click
@EnglishRain Жыл бұрын
You are so fantastic i live you and miss you thank you so much for your amazing content!!
@jinyang47964 жыл бұрын
== checks for equality is checks for identity (i.e. are the objects from the same memory address?) Values can be considered equal without being the same object in memory.
@oltlatifi48705 жыл бұрын
Thank you for what you're doing
@souvikghosh69665 жыл бұрын
If the names to the two persons are the same, then we call they are '==' to each other. If they look like exactly the same like twins then we call they are identical, which means they are 'is' to other. Nice!!!
@khireddinebelkhiri7255 жыл бұрын
do you know bro u are great thank you from algeria
@thinktech2936 Жыл бұрын
Very well explained
@blueexorcist43005 жыл бұрын
what happens if you use the is on two primitives?
@ericdrumond_ancap5 жыл бұрын
Hey man, I am from Brazil and I like a lot your videos. Do you have plans to make a Kivy Tutorials??? Thank you for the amazing videos.
@coreycarter56685 жыл бұрын
Even though I already understood this concept.....just going to watch the video because well-he’s amazing!
@adityaprasaddhal24625 жыл бұрын
Thanks for knowledge
@aikimark19555 жыл бұрын
I wish you had included a "Type() is" example as well as the .copy() method for your second list
@krishnachaitanya10785 жыл бұрын
Thank you corey
@balzerno15 жыл бұрын
Its funny how i was looking at the exact same thing just before clicking on this video haha
@legend78904 жыл бұрын
really good explanation
@linuxrant Жыл бұрын
wonderful video!
@robot3415 жыл бұрын
This is Important topic, Good !!
@Yashparwal12 жыл бұрын
thanks for the explanation
@MJFAN6665 жыл бұрын
That's weird.. So what if I say l2=l1 and modify l2? Will it also change l1?? What if I wanted to make a copy of the var without messing with mem location?
@yoyolubi6 ай бұрын
Let me se if i got it right... so basicaly when you use l2 = l1 in Python is the same thing as you use int* l2 = l1 to point to the l1 array in C, both lists (or arrays) end up refering to the same memory address? But when i use l1, l2 = 100, 100 print(l1 is l2) It returns true, so why? I mean... i didnt use l1 = l2 although they have the same value... Is it because both are the same instance of the integer class in Python, and by that refers to the same object when l1 and l2 variables recives their values?
@franciscorossi56334 жыл бұрын
Could anybody tell me which program or text editor is he using to run Python in this video? Thanks
@Miyota_90155 жыл бұрын
Thanks bro, any chance of you recording a series on Flutter in the future? that would be amazing!
@mohsam38685 жыл бұрын
d=[0.25,0.10,0.50] def coin(num): for i in d: if num%i == 0: print(i) coin(1.25) coin(2.2) '''why the reminder in this case is not equal zero '''
@daniloreboucas58885 жыл бұрын
2.2 % 0.1 returns a number very close to 0 instead idk why but on my console it is returning 5.5e-17 instead
@daniloreboucas58885 жыл бұрын
I think when performing this division python uses very close approximation of the numbers instead of the actual values
@Bread-vk8fl3 жыл бұрын
How to comment everything like he did at 5:59?
@haroldaaron20984 жыл бұрын
Great videos about python, please make a video about comparison of Pass by value,reference and Pass by object reference in python, Hope to see more videos also in advance python
@arar44545 жыл бұрын
Can you make some videos to : How i make exponential fits and gaussian fits
@mauricioyaman5705 жыл бұрын
excelent explanation
@scifregizmoguy5 жыл бұрын
# An `is` expression: A is B # Will evaluate to a boolean. # An equivalent expression: id(A) == id(B)
@AjayJain-ef2mz4 жыл бұрын
what about id(A) is id(B)?
@hamidsk25735 жыл бұрын
dear Corey can you made python tutorial for the advance programming feature in python like multitasking , multithreading and async task
@AbdurRahman-iy7nd4 жыл бұрын
Thanks for your definition. I got the point. But the example with pepsi is not so relevant.
@tinman2225 жыл бұрын
Hey Corey , i am using ckeditor in a django blog app hosted on digital ocean , and using digital ocean spaces for serving static files which uses amazon s3, but when it is not working properly can u plz make a video on it, i am debugging for atleast 10 days ckeditor uploader not working and even when it says paste the url it also not working, plz plz plz help me plz its very important and urgent bcoz my app is already on server
@benx57815 жыл бұрын
🏀=ball 🎾=ball 🏀=🎾 if 🏀==🎾: print("🏀==🎾") if 🏀 is 🎾: print("🏀 is 🎾") Here output will be: 🏀==🎾 🏀 is 🎾
@ihalil955 жыл бұрын
Amazing video as always. My question is x = 2 y = 2 if x is y: print(True) x and y are different. but their id(x) and id(y) are the same. Why? Also when make y = 2.0 float its id changes.
@coreyms5 жыл бұрын
That’s because some common values are immediately stored in memory when Python is first run for efficiency reasons. So sometimes you get behavior like this. But I wouldn’t rely on using “is” in that way in your programs because it won’t always be true.
@CT7ALW5 жыл бұрын
Check my answer to Avinash Pandey ( &lc=UgwEAvkuTKLuEe27Kfh4AaABAg.8yIgY8IB_8f8yIrgMw5R6u )
@gfddgitgud38482 жыл бұрын
Thank you Thank you Thank you !!!
@delapuenteignacio5 жыл бұрын
One thing that might be worth adding is that if I define two integers rather than lists, then they both get stored in the same memory location. i.e. x = 3 y = 3 "x is y" outputsTrue. This won't happen with strings unless its just one word. So if x = 'a string' y = 'a string' "x is y" outputs False but if x = 'justoneword' y = 'justoneword' "x is y" outputs True. Go figure...
@rajath19645 жыл бұрын
same holds good for string also, name = "tony" name1 = "tony" print(id(name)) print(id(name1)) if name is name1: print(True) else: print(False) ********************************* the above code returns same memory reference and True. i think he was specifically describing for lists
@aggieaggie39465 жыл бұрын
hey Corey, thanks so much for the tutorials, they are really good but would you do a tutorial on how to all some one comment on your posts in your blog?thank you, i will really appreciate
@tinman2225 жыл бұрын
Or can u make a video on how to implent a good wsywig editor which has file uploading and accesing functionality in in django app on front and also on admin panel , in text area
@pushpajitbiswas37525 жыл бұрын
Good explanation, can you make a video over pandas, numpy, opencv any one of these?
@TeguhGunawan5 жыл бұрын
Thanks 👍
@geoClexE3 жыл бұрын
thank you so much !!!
@vkrs33152 жыл бұрын
Thank you so much
@ember9361 Жыл бұрын
it did! thank you :)
@tyt003415 жыл бұрын
Thanks u teach well may I check which python IDLE are u using thanks
@lelgenio5 жыл бұрын
I think he uses Sublime text Also, IDLE is the name of the simple python IDE I would recommend you trying Thonny if you are just starting
@geeseguy27152 жыл бұрын
List = [1 , 2] "Okay" List[1] = 1 "Okay" List[2] = 1 "Okay" List [1] == List[2] --> True "Makes sense" List[1] is List[2] --> True ?????????????????
@G_a_n_d_u3 жыл бұрын
Corey Schafer ! = others programmer❤️
@0Navin02 жыл бұрын
Thank you.
@GK-lf1ll5 жыл бұрын
Why do we have two variable names for same memory location? Where can we apply in programming?
@s1n7ax5 жыл бұрын
If you have a object list, and you want to remove a given object from the list, you can use 'is' i guess. Not a python programmer but most of the languages are using 'is' concept by default so this is one use case.
@ginopornasdoro91835 жыл бұрын
do you have laravel tutorial?
@samytamim2603 Жыл бұрын
can we use is keyword with Primitive Values ?
@andrewluo60885 жыл бұрын
you are the best teacher
@RichellyItalo5 жыл бұрын
Please, what's your font family?
@coreyms5 жыл бұрын
Source Code Pro
@RichellyItalo5 жыл бұрын
@@coreyms thanks. One more thing. And the color scheme?
@coreyms5 жыл бұрын
Richelly Italo Predawn. I have a video on how I set up my Sublime Text if you want to see the full setup.
@RichellyItalo5 жыл бұрын
@@coreyms Thanks man!!! I'm watching now.
@needsomehike5 жыл бұрын
what text editor are you using in these videos? (does anybody know?)
@andreamagista67425 жыл бұрын
Sublime text
@needsomehike5 жыл бұрын
@@andreamagista6742 thank you!!
@maievmaiev83275 жыл бұрын
how can i copy l1 in another list named l2, and when changing l2 it wont affect l1, cause by copiying with =, the changes done on l1 will accure on l2
@coreyms5 жыл бұрын
Hey there. Great question. Instead of giving all the different options in a long comment, I think this StackOverflow answer does a great job of explaining your different options: stackoverflow.com/questions/2612802/how-to-clone-or-copy-a-list
@dmitryvlasov9315 жыл бұрын
l2=l1.copy()
@maievmaiev83275 жыл бұрын
@@coreyms thank u
@maievmaiev83275 жыл бұрын
thank u!
@muhtadilaskar76505 жыл бұрын
You are awesome
@fantasticghosts73665 жыл бұрын
Nice.
@rubemjr96235 жыл бұрын
So is the is keyword equivalent to comparing C pointers?
@umaraftab60735 жыл бұрын
Hey Corey, can you please make a short video explaining '_' and '__' used in variable declaration in Python? Thanks
@FixDaily3 жыл бұрын
That has to do with Private ( _ _ ) or Protect ( _ ) properties on Classes.
@ameerikbal81605 жыл бұрын
s = "india" b = "india" print(s is b) this code gives me a True value
@coreyms5 жыл бұрын
Sometimes smaller strings can share objects in memory. But you won't get the same behavior where changing one variable affects the other like a list because strings are immutable. With longer strings you shouldn't see that behavior.
@ricardoseung17854 жыл бұрын
Is the command "is" the same as command "="? thank you!
@tiagu80854 жыл бұрын
No. '=' is assignment
@ldizai5 жыл бұрын
Hi Corey, thanks for all teh vids! Could you do one on how to check if the person is a subscription member or not in Python-Flask. I've learned everything in your Flask Blog app. So after that is done, how to set up members account for premium features via payment.
@desmondade5 жыл бұрын
You can basically have a field in your user model name is_subscriber which is a bolean and set this value to true when a user subscribes in the payments route or you have a OneToOneField to add this extra info
@ldizai5 жыл бұрын
Straight Emirati thanks!! I’ll test it out
@desmondade5 жыл бұрын
@@ldizai yeah just try it out any problem I will be glad to help
@j05849243 жыл бұрын
It should be noted that "is" works a bit differently for mutable and immutable types...
@elgalvin4 жыл бұрын
Advise you to use Ctrl+D to duplicate the code on the next string
@sainco30365 жыл бұрын
thanks.
@RameenFallschirmjager5 жыл бұрын
great explanation. 'banana' is 'cucumber', because both of them are slender and they are fruit! have I got the gist of this video right?!
@tulsivanol5 жыл бұрын
Hello sir, Can u make a tutorial on numpy and pandas?
@leemoore81544 жыл бұрын
This doesn't seem to work with integer values. a = 5 b = 10 - 5 print(a is b) ----- True If you change it to b = 10/2 to get a float, then it prints False, but if they're both integers with the same value, they seem to be stored in the same place in memory.