2.5 Get more context: learn about Python - Video Tutorials & Practice Problems
Video duration:
7m
Play a video:
Video transcript
<v ->So let's take a break now from coding</v> and look at something completely different. We're gonna talk about the history of the Python language and how it's being used. So, Python was originally created and released in 1990 which is, for reference, the same year that the Simpsons came out. So it's a pretty old language. It's not this new, hot thing, but it is gaining more popularity in recent years. It was created by Guido Van Rossum, a Dutch programmer, and he has labeled himself the Benevolent Dictator for Life, but he actually stepped down from that role in July 2018. So why does it need a benevolent dictator for life? That's because it's an open source language, but we don't wanna let just everything in. There needs to be an overarching vision, someone to veto proposals, whatnot. He was also a big fan of Monty Python, the English sketch comedy troupe, and Python is actually named for Monty Python and not the snake. So throughout the documentation and tutorials, you might see some little references to Monty Python sketches. And the Python language evolves over time through something called PEPs or Python Enhancement Proposals. So here's an example of an excerpt from PEP 8, or the Style Guide, which says that we wanna use four spaces for indentation levels and also that spaces are preferred to tabs. Well, thankfully we're using Pycharm and tabs get converted into four spaces anyways. So yeah, the style guide has a lot of different things like this. This is a style guide that Pycharm will give you little warnings about if you're not writing code according to the style guide. There's also PEP 20, which is the Zen of Python, and it's longer than this. There's actually 20 lines, or 19 lines, but the start of it is beautiful is better than ugly, explicit is better than implicit, simple is better than complex, complex is better than complicated, and readability counts. Unlike other languages, Python has kind of an essence that is written out in the Zen of Python and the main thing is that code is more often read than written. So we should try to make clean, readable code and aim for that as much as we can. So here's some sample code of a larger program and you can see that it's using simple common English for a lot of things and it uses white space to indicate what piece of code belongs to what other piece of code. So some other languages will use curly braces and have semi colons at the end of lines, and Python doesn't do that, so it is fairly understandable if you read it. So, one major thing is that white space matters. This white space matters, and in some other languages, white space doesn't matter. So these should be four spaces to indicate that you're now in a new code block. It's also dynamically typed, so like we showed earlier, in the variables section, that a variable can have any type inside of it and you don't have to indicate what type you're storing. So, number, you don't have to say "number holds an integer", you can just make it set to anything. And then, simple English is preferred. We use words words like "and" instead of && and print instead of system.out.printline. Things like that. And where is it used? So, it's used in a lot of popular companies, so for website back ends. Django is used, the Django framework written in Python is used by Instagram and YouTube and Dropbox and it's used in most companies for data science. That's one of its really prominent uses in the software industry world. It's also useful for sys admins, dev ops, like people who are configuring computers because it's a good scripting language. It's used in animation and film to do pipeline stuff, or this is the MIA program and you can actually script in MIA using Python. Even some hardware companies use it for testing. And it's also a good language for the Raspberry Pi, like a little mini computer. You can run Python on it and program all sorts of internetive things type stuff. So Python 2 versus Python 3. I've alluded to some of the differences before, but I'll talk about it more now. 2.0 was released in 2000, and 3.0 was released back in 2008 so it's kind of a long time ago already, but the programming world has taken awhile to adopt 3.0, but now the push is becoming a lot more strong since the Python Software Foundation is stopping Python 2 development as of 2020. So there won't even be any security upgrades. So everyone should be moved over to Python 3. So Python 2 is more widely used still because there were a lot of libraries already on two, so those libraries had to move to three before applications could move to three. But since it's no longer being updated with new features, and Python 3 has some really nice features that you should use, you should use that because it is the future. Some of the things that are different are you now need parenthesis around when you're calling print functions. So you used to not, but since it is a function, they wanted to make it more similar to other functions. And then also, f strings are a new way of doing string formatting as of Python 3.6 and as we saw earlier, division now is float division instead of integer division. So the reason that, these might seem like small changes, but since Python 3 code will not run on Python 2 code, these are some of the breaking changes, like the print and the division, so they had to increase the main number. So the way that software versioning works is the first number will tell you if it's backwards compatible and then the second number, they add new features, and then the third number is for bug fixes and stuff.