Python Fundamentals Why Python
Transcript from the "Why Python" Lesson
>> Nina Zakharenko: So Python, it's a programming language. You might be surprised to learn that Python is actually 30 years old. It's probably older than some of you in the room, it's been around for a long time. And during that time I feel like there have been a couple of misconceptions that have come up about Python.
[00:00:19] Some people think that Python is just a scripting language. It's not, it's used that company is from Reddit, Netflix, Dropbox, Quora. There are tons of other companies that make productive use of Python. Some people say that Python doesn't scale, that's also not true. Instagram is the largest installation of Django, which is a Python web framework, and they have 1 billion users, is that number right?
[00:00:52] I believe it's 1 billion. Yep, they just hit the billion mark. So, you might hear a little bit about Python 2 versus Python 3, you might hear a lot about it. This part's a bit of a stain on the python programming language. Python 3 was released in 2008, so it's 11 years old, and it's adoption was really slow.
[00:01:13] First and foremost because it took really popular languages a fair amount of time to port over their code, but the debate is over now. Python 2 is gonna reach end of life in 2020, meaning that important updates including maybe security updates are gonna stop being released. So this course and your code going forward should always focus on Python 3 only.
[00:01:37] Why Python? Python is a language of open source, and the language is open source. You can look on GitHub right here. And if you'd like, if you advance in your Python journey and you feel comfortable enough to contribute, even to the documentation, you can. Which can't be said for a lot of other languages.
[00:02:02] It also has a wide variety of applications, like AIML we talked about earlier. There are tons of Python packages, SciPy, NumPy, Pandas, PyTorch, all very popular. Python has made the work that scientists do so much easier. It's been instrumental in a number of breakthroughs and discoveries. It can be used on hardware microcontrollers.
[00:02:31] Raspberry Pi started this at homemaker movement of tinkering with hardware. There are MicroPython and CircuitPython, Python variance that can run on micro controllers as small as a quarter. Which is one of my hobbies, I love playing around with those types of things. There is web developments, so Django and Flask are two hugely popular web frameworks.
[00:02:56] But then if you want to do scripting, you can do that too. It's very popular for DevOps and configuration scripts, etc. Python also has a really rich standard library, as well as the PyPi package index for third-party packages. In February of 2019, it contained 167,000 of them. And Python is considered a batteries included language, because the standard library also contains a majority of the libraries and packages that you might need under standard application.
[00:03:30] People believe that that's why Python became popular in the first place. And to me, one of the most incredible thing about Python is the community. The biggest yearly conference is PyCon US, there are approximately 4,000 attendees. There are lots of user groups worldwide, a lot of them are listed, there's a wiki.
[00:03:53] There are also many supportive groups for women and nonbinary developers such as PyLadies and Django Girls. And these organizations have chapters in most major cities across the US and internationally. Let's quickly talk about conventions. So, in Python, the most important convention is PEP8, and there's kind of a lot to it.
[00:04:18] So, we can look at this site which is pep8.org, it's a little bit of a standard on site. So PEP8 is a style guide for Python code, this is one of the nicest parts of python code. There's just a kind of this globally accepted style guide, if you have a link to it, it'll give you suggestions when you're not following it.
[00:04:41] And that makes most good Python code look very similar, makes it very easy to read, you know what to expect. I worked on some Java projects where we had a debate and we didn't have a style guide and some people would put their opening curly brace on the same line, and some people would put it on their new lion, and it would make for nightmare diffs, right?
[00:05:04] Python really minimizes that. So, I recommend looking through this briefly. But in the meantime let's look at a few of these. Indentation, it's four spaces per indentation.
>> Nina Zakharenko: Four spaces per indentation level is the standard here. It'll tell you about tabs or spaces, the maximum line length, also comments, whitespace, naming conventions.
[00:05:35] So here's there some descriptive naming styles, for example, use lowercase with underscores, capitalized words when using classes, etc. Cuz kind of a lot here, we'll talk about it when it pops up, but when you hear me say PEP8, you're know what it means.