Python3 vs. Python2

A free video tutorial from Colt Steele
Developer and Bootcamp Instructor
Rating: 4.7 out of 1Instructor rating
21 courses
1,308,150 students
Python3 vs. Python2

Learn more from the full course

The Modern Python 3 Bootcamp

A Unique Interactive Python Experience With Nearly 200 Exercises and Quizzes

29:43:16 of on-demand video • Updated July 2022

Learn all the coding fundamentals in Python!
Work through nearly 200 exercises and quizzes!
Learn about all of the latest features in Python 3.6
Use Python to create an automated web crawler and scraper
Make complex HTTP requests to APIs using Python
Master the quirks of Python style and conventions
Really Really Understand Object Oriented programming in Python
Learn testing and TDD (Test Driven Development) with Python
Write your own Decorators and higher order functions
Write your own Generators and other Iterators
Confidently work with Lambdas!
Master tricky topics like Multiple Inheritance and Polymorphism
Build games with Python
Build larger projects that span across multiple files
Work with all the Python data structures: lists, dictionaries, sets, tuples, and more!
Become an expert at list and dictionary comprehensions
Master built-in python functions like zip and filter
Handle errors and debug code
Write your own custom modules
Work with files, including CSV
English [Auto]
All right. Welcome back. Let's quickly chat about Python two versus Python three. So if you're like me, you're probably used to your software updating and changing all the time, whether it's your phone's operating system, your gaming console that happens to upgrade and restart, right? When you download a new game or your computer, your windows or Mac operating system. These things change all the time. There's always new versions, and programming languages are really no different. They're always enhanced. They're always changed. New features are added in. It's constantly a process of growing. So back in 2008, the creator of Python, his name is Guido van Rossum, was a bit unhappy with some of the really important architectural decisions that were made early on in Python, and he wanted to change them. So he decided to overhaul Python and release Python three. So this was ten plus years ago in 2008. And at the time the goal was to be for Python three to be the present and future of the language. People were supposed to adopt it pretty quickly and stick with it. But as you can probably tell just by the fact that I have to make this video, it was more complicated than that. And the reason for all the trouble, all the controversy, is that Python three is not backwards compatible. So usually when you have a programming language and changes are made, it's made incrementally and it's made in a way that old code can still run. So old JavaScript written five years ago. If you tried to run it now, there won't be any problems. It won't be using some of the new features. It might not look as nice, but it will still work. But with Python three, the opposite was true. So the all the existing users, the existing companies that were built on Python two, their code, their libraries, everything that they had done up until that point would not work if they were run with Python three. And because of that, still to this day, Python two point X is still commonly used. Python three is now very, very common. But that wasn't always the case because it's taken a while for companies and for libraries to fully support Python three, because it had to be it was a decision. Oftentimes with other updates, you just kind of opt into it without thinking. But going from Python 2 to 3 is a very deliberate choice you have to make if you're on a team at a company. That team had to decide to migrate to Python three, so it took a while. It's over ten years later and it's still not fully solved. So this is a little diagram. Back before Python three came out, it was one big happy family. All these developers, everybody in the Python community was writing Python two point X and they say hi to each other. They send hearts back and forth, so real happy. But then Python three came out, which was an attempt to make Python great again, and there was very mixed reactions as signified by all of these emoji here. It was very, very polarizing. What ended up happening is that the community was split. We have this box with a line through the middle and now our happy family has been torn apart. And if you're someone who's trying to learn Python for a while, it's been a little confusing about where you should start. There are thousands and thousands of blog posts and articles and YouTube videos where people explain the difference and talk about why you have to learn Python two or why you have to learn Python three, or how to decide if you're new. It goes on and on and on. And for a while there really was a lot of ambiguity around it. Python two was definitely the best choice early on, but things have changed. It's just been really slowly, very incrementally. But almost ten years later, Python three is absolutely the way to go. The situation has improved a ton. So what makes me say that? Well, first of all, it's just easier in general to learn the most up to date current standards, to learn Python three and then go back. If you need to work in Python two for some reason, you can figure out the key differences in the quirks rather than going the other way. But more importantly, most of the main criticisms are things people didn't like just don't matter anymore. It used to be that all the popular packages, all the tools that people would use, the utilities that were written for Python were only written in Python two. So if you upgraded to Python three, you are in this frontier land where you couldn't rely on common packages that you were used to, but that's no longer the case at all. There's a website here. I'll include the link called Python three Readiness, and it shows out of the 360 most popular Python packages that are used all the common, all the important things that you would ever need to do. Well, not everything, but most of the things you'd ever need to do. They are all supporting Python three now out of the top 360. What there's 12 that aren't and you can see them here highlighted in white. But everything else is supporting Python three. But this wasn't the case just a couple of years ago. It was a much different picture. So many of the older courses still encourage you to learn Python two because at the time that's what everyone was doing. But like I said, the situation has changed. All the popular packages you'd ever need support Python three So that's not a that's not a problem. Not a question anymore. But the most compelling reason, honestly, is that Python three is the future. There's also the fact that Python two is going to be retired officially. So Python 2.7 is still being maintained now. But in just a couple of short years in 2020, at some point there's not an official date. There's going to be a time where it's not maintained, so there's not going to be these two versions going forever. Python three is designed to be the version that lives on. So everybody who's learning Python two right now is going to have to move over to Python three. If you're curious and you want to dive into the differences, it might be easier once you've learned some python, but there's this website that goes into the key differences between 2.7. X and three point x. So one just really quick example I'll show you. One of the first things we'll learn in this course is called the print function. And in Python three, it looks like this print and then parentheses and we pass in something to print. In Python two, print was a statement rather than a function. So you didn't add parentheses. You could do it like this. Print space. Hello world in Python three you have to add the prints. So it's a minor difference. But you can see if you wrote code in Python two and you didn't have those prints and you tried to run it in Python three, it wouldn't work because that's no longer valid code. So if you are a complete beginner and you are deciding, I think the case is is pretty clear cut to learn Python three at this point all of the blog posts criticisms that you could still find out there. Most of them are old and they're out of date because the situation has changed. And just remember that Python three is the future. So I sound like, you know, I'm trying to sell it to you or something, but it just is that that's not even my choice. The developers of Python have made it clear that Python three is where things are going, so why not learn Python three? And finally, one more picture of my cat. That was a long video like that little grumpy face.