Python Quick Tip: The Difference Between '==' and 'is' (Equality vs Identity)

preview_player
Показать описание
In this Python Programming Tutorial, we will be learning the difference between using "==" and the "is" keyword when doing comparisons. The difference between these is that "==" checks to see if values are equal, and the "is" keyword checks their identity, which means it's going to check if the values are identical in terms of being the same object in memory. We'll learn more in the video. Let's get started...

✅ Support My Channel Through Patreon:

✅ Become a Channel Member:

✅ One-Time Contribution Through PayPal:

✅ Cryptocurrency Donations:
Bitcoin Wallet - 3MPH8oY2EAgbLVy7RBMinwcBntggi7qeG3
Ethereum Wallet - 0x151649418616068fB46C3598083817101d3bCD33
Litecoin Wallet - MPvEBY5fxGkmPQgocfJbxP6EmTo5UUXMot

✅ Corey's Public Amazon Wishlist

✅ Equipment I Use and Books I Recommend:

▶️ You Can Find Me On:

#Python
Рекомендации по теме
Комментарии
Автор

⚽ = "football"
🏈 = "football"

⚽ == 🏈
>>> True
⚽ is 🏈
>>> False

pepehimovic
Автор

'coke' == 'pepsi'


*_BLASPHEMY!_*

Remls
Автор

Are you writing a book? Cause I'd buy it.

scarletdcruz
Автор

I just watched your video on Unit Testing and wished to have you upload the next one. And, then here it is. :)

umaraftab
Автор

I had no idea lists would behave like that, that's really important to keep in mind when assigning variables!

Xartab
Автор

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!

rsrazorfen
Автор

Extremely well explained! It was a bit confusing in the pepsi example but the programming example made it all clear.

shreyashkashyap
Автор

Excellent. Would be nice to see how "is" interacts with "not", "in", ect.

Gaspar.Albertengo
Автор

this is the best type of content please keep educating us like that

karimkohel
Автор

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!

scotttct
Автор

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

leondaz
Автор

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 <3 !! Got a test on monday :S ...

cati
Автор

what happens if you use the is on two primitives?

blueexorcist
Автор

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?

davidcarter
Автор

Awesome, thanks for the clear explanation..

rounakghosh
Автор

Thanks bro, any chance of you recording a series on Flutter in the future? that would be amazing!

void_invoker
Автор

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!

changanzhang
Автор

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

tinman
Автор

Your video really easy to understand <3. Can you talk about args and kwargs in next video .Thank you

lethanhtu
Автор

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.

ericdrumond_ancap