Check out a free preview of the full Practical Guide to Python course:
The "Why Python & Python Philosophy" Lesson is part of the full, Practical Guide to Python course featured in this preview video. Here's what you'd learn in this lesson:

Nina describes the history of Python, and why it appeals to a wide range of developers, from beginners to large-scale development teams at Instagram or Dropbox. Since Python is open source, there is a large community of contributors and third-party packages.

Get Unlimited Access Now

Transcript from the "Why Python & Python Philosophy" Lesson

>> All right. So what is the draw of using Python? How is it different from other languages? What advantages does it offer? Python is a dynamic programming language. And this really caught me by surprise at first, it was created by Guido van Rossum in the late 1980s. That means that Python is 30-years-old.

[00:00:20] That means that it's older than some of you. It is old enough to vote. So a lot of folks think that Python is a new language. Or that it's new on the scene. That is not true. It's just been gaining a lot of popularity in probably the past ten years or so.

[00:00:40] There's also this common misconception that Python is only a scripting language. It's really simple. And that is not true at all. Django is a web framework that's built in Python is used to run Instagram, which is one of the largest websites in the world with the most users.

[00:00:58] It powers parts of Reddit. It's used at Netflix and early versions of Dropbox were built almost entirely in Python. Dropbox credits a lot of its success to Python, because Python is easy to read and easy to write and it's easy for teams to collaborate in Python. They had this idea and they were able to get a product out the door as quickly as possible.

[00:01:23] And then, when they had to scale, that was something that they started dealing with by replacing parts of their application with go or other more performant languages. But they didn't optimize when they didn't need to and that let them have this. Very, very successful company. It's also becoming an increasingly popular language for education of all ages.

[00:01:47] There is our Python books for kids. Python is taught in universities and I found this great quote that in 2014, Python was the most popular teaching language at top US universities. And if you know Python, you might not have a hard time finding a job. Because it's one of the fastest growing programming languages.

[00:02:12] Guiteau said that Python is now also the language of amateurs. And I mean that in the best way possible. That means that the language is accessible to a lot of people. One of the great things with Python is that it's open source. It's an active development, there's a committed team of core contributors and there are also a lot of issues that are tagged welcoming for beginners.

[00:02:37] So as you advance in your Python journey, if you decide that you want to contribute back to the language, that is something that you can easily do. We chatted a little bit about versions in Python. You might hear something about Python 2 versus Python 3. What's that all about?

[00:02:56] I will say that this is maybe a little bit of a stain on Python's history. Python 3 was actually released in 2008. And its adoption was very slow. There were a lot of really popular frameworks that didn't want to migrate because it would have been a lot of work.

[00:03:15] And because of that, a lot of folks stuck to Python two and instead of Python three, there was some breaking changes that were introduced. At this point, that chapter is now fully closed. Python two seven, which was the last version of Python two is deprecated. It has reached its end of life, it's not getting critical security updates.

[00:03:37] It's not getting critical, new features that you might want to use. So it's time to use Python three and move on from Python two. All of those popular libraries and frame works have now migrated as well and are likely not supporting their Python two features because that's double of the work.

[00:03:59] So this course is going to focus on Python three only. And I would encourage you all to use Python three for all your personal projects and projects at work. Python has an incredibly rich fully featured standard library, there is a saying that Python is batteries including. So anything that you might want to do, like working with JSON.

[00:04:26] All of those are included in the standard library, you don't need to install any additional packages. And there's a link here into the standard library and you can kind of go through here and see what is available, there's a lot of, stuff. There's also the PyPi package index for third party packages.

[00:04:49] As of today, there are almost 300,000 projects, and almost half a million users. So, this is where you go where you want to find something that's maybe water or more niche. And there are lots of third party packages available for many different uses. There's tons of stuff for AI and Ml Scipy Numpy pandas pytorch.

[00:05:20] There are great options for hardware and microcontrollers. There are two very popular web development frameworks that are Django and flask lots of tooling for DevOps. And the absolute best part of Python is actually the incredible community. So after this course, I encourage you all to continue in that community.

[00:05:41] PyCon US is the biggest yearly conference with approximately 4000 attendees. There are lots of local user groups. A lot of them are listed in a wiki that is linked. A lot of these groups are now having online and remote events that you can participate in. And there are also many great and supportive groups for women and non binary developers, such as pi ladies and Django girls.

[00:06:09] And these organizations tend to have chapters in most major cities. And they do a lot of really, really great work. So, a little bit about the philosophy of Python. A lot of ideas in Python were formed by something called the Zen of Python. It's a collection of 19 software principles that was sent to the Python mailing list in 1999.

[00:06:35] And you can actually find the Zen of Python included in the Python distribution as an Easter egg. So let's go to our repple wherever you have that open and type import this. And we're not gonna read this whole thing. But the the top few tenets beautiful is better than ugly.

[00:07:03] Explicit is better than implicit, simple is better than complex, complex is better than complicated. Flat is better than nested sparse is better than dense, and most importantly, readability counts. So as you advance through your Python career, you'll see more and more of this in practice. Python code should be simple, you shouldn't try to make the most, the smallest one liner that nobody else can understand.

[00:07:37] Python can give you those tools. You can do it, but you shouldn't. You should focus on making your code very clear. Very simple, very readable flat is better than nested means don't have arrow shaped code. So no if statement if statement if statement if statement, not a ton of nested loops.

[00:08:00] Try to keep everything as close to the left margin as possible and really focus on this is what makes Python different from a lot of other programming languages. Now a way that Python encourages you to write simple, readable code is with a style guideline that's included in the languages list of official proposals it's called Pep eight.

[00:08:34] And if we take a look at this Pep eight gives coding conventions for Python. Everything from indentation to maximum line length to where blank lines should be to where, how the spacing around equal signs works. You don't have to remember all of these rules because tools called linters, he should have installed a linter in VS code.

[00:09:04] We'll show you warnings when your code doesn't meet PEPB standards. Know that the warnings that lintec linters give they're not syntax errors, your code will still run, but it won't be accepted Python code style standards. Not very important when you're working on your own, but much more important when you're working on a team and collaborating with others.

[00:09:27] There are a few other easter eggs that I'm going to show you. Actually, I don't know if this one works in Python three. This was a Python two easter egg. There we go. So if you type from underscore future import braces like well Python the programming language ever get braces, you'll see a syntax error and the message is not a chance.

[00:10:00] [LAUGH] So Python won't be looking like JavaScript anytime in the near future. And then one of my favorite easter eggs is if you import anti gravity. This will take you to an XKCD comic about Python that says you're flying how with Python I learned it last night everything is so simple.

[00:10:26] Hello world is just print hello world says Python two and Python three you need those parentheses. So, yeah, pythons a pretty fun language but it's also very, very powerful. We're going to take a short. Break before we talk about the anatomy of a Python program and jump into data types,