Introduction - Intermediate Python Programming p. 1

sentdex · Beginner ·🛠️ AI Tools & Apps ·9y ago

Key Takeaways

The video introduces the intermediate Python programming tutorial series, covering topics such as efficiency, maintainability, and modularity, with a focus on standard library, object-oriented programming, and best practices like PEP 8 and the Zen of Python.

Full Transcript

what is going on everybody and welcome to an intermediate Python Programming tutorial series or maybe better called python fundamentals that aren't Basics anymore okay so uh in this tutorial series we're just going to be talking about stuff that I just don't feel like fits anymore in the Python 3 Basics tutorial Series in the past I've just kind of added on to that over time but we're getting to the point where I just don't think it's Basics so first of all like my definition of Basics is at least how I felt when I was doing Basics and that would be like let's just make this work right that was my goal whenever I was first starting out so I just didn't care that much about uh efficiency and scaling and stuff like that I was just trying to learn about the language and make it work now with intermediate Python Programming I kind of break these down and there's kind of like three Hallmarks or trademarks of intermediate Python Programming and that is one it's efficient and it scales well because as you grow a project and if the project is successful it needs to be able to scale otherwise you're going to have to go back and pay off a bunch of what's called technical debt basically uh so you want to be able to scale really well also along those lines the second thing is just maintainability so a lot of this is just readability and how easily we can understand it but also just how well you write your functions and classes and methods and stuff like this that allows you to actually grow over time and improve it because a lot of times you're just going to get to the point where as the project grows and you want to add new things or change things it can become just a huge spiderweb mess nastiness then finally the third thing is just modularity and so the idea here is that when you you make something your goal should be that maybe you want to use this in other projects of your own or maybe other people can make use of the code that you're writing so you want to make something that's extremely gener generalizable uh that should be the goal and that's actually really hard to do and if you're not always thinking about that it's really easy to take the short route and sacrifice modularity but also sacrifice uh maintainability and even efficiency but for the most part scaling and efficiency is more of like a knowledge thing you just need to know how to do it as opposed to maintainability and modularity that's more of like a mindset that you really need to have so one thing I always like to show I've shown this picture a few times before but I think it's a really good one is this kind of comic and the idea is that you know you start with a clean slate and then you build your first project and that's just the simple house and then over time as the project grows you want to add these other little things to it and as time goes on it just gets way out of hand everything's just kind of pieced together there was no thought about I mean obviously I guess this is kind of modular um but it's really difficult for this Pro this kind of kind of project to scale when you're just kind of gluing things together and again it's more of like a mindset when you're writing things especially we're going to be talking um basically this series will start with just some standard library and standard functionality of python that again just isn't basic and then we're going to get into object-oriented programming uh and so as you build let's say uh your classes and stuff like that it's like a it's more of like a mindset when you have to think about okay how could I use this in the future and how can I grow this in the future and so um a good test of that is just to basically have it in a separate file so I'm usually not somebody who's a big fan of making these huge packages but at least the first time you're building uh a class that can actually help out but we'll talk more on that as we go also in terms of maintainability I will just point to pep 8 pep 8 is a style guide it's not Style by for python code it's not it's not dogmatic it's just a it's more of like a suggestion more than anything else if you don't feel very strongly about something use whatever pep eight says or if uh a lot of times you might work in teams like for example Google has their own style guide so if you go to work for Google you're there's some differences between Google's version of styling and pep8 but for the a large part uh people generally follow the same practices and we'll try to adhere uh a decent amount to pep eight but there are certain things I just fundamentally disagree with uh with pep Aon uh just for one quick example will be line length 79 characters just feels unbelievably arbitrary and it encourages you to have like really short or uh like a short function names and short variable names that aren't descriptive aren't readable and also to uh neglect some times having like if especially like when you've got a function and you're actually going to use that function um sometimes it's not clear what that parameter is just by the variables name so you kind of want to have the parameters name equals variable name but if you're trying to not not exceed 79 characters it's really easy oh we'll just chop off the parameter and equals and boom we're good that's that's pep eight that's right right um I don't I disagree with that and there's a few other things in Pepe I just I I just feel like come on guys but anyway um we'll we'll do a lot of things like the naming conventions we're going to follow and stuff like that so pep eight read through it uh it's it's a good read regardless it's something to think about next uh we're going to bring up uh python shell uh let me make it large and probably in my opinion more important than pep8 is the Zen of python you should just always kind of have this in your mind so you can just do import this and this is kind of the the Zen of python um and basically just kind of always be thinking of these things so you know I'm not going to read this all to you but beautiful is better than ugly is one that pretty much everybody violates uh simple is better than complex is one that has unbelievably um complicated ramifications um so maybe we'll show some examples of that flat is better than nested is also usually very complex Andor complicated so a lot of these things are are contradictory in practice practice but um it is something to always kind of think about and try to make your code adhere I would say adhere more to the Zen of python uh at least a line in the Zen of python than pep eight but anyways keep that in mind it's kind of a nice thing to have so uh as this uh tutorial series progresses you can make uh suggestions or recommendations or if I do something that you have a better method of doing it or you think you have something that's more it's going to scale better it's more easily readable and it can scale better because we're going to talk about how scale and readability often come into conflict with each other um but if you've got a better idea or whatever feel free to contribute to the series so uh like I said before the next few videos are just going to be more of kind of built-in things like generators and list comprehension that kind of stuff then we're going to talk a little bit about standard libraries we're going to be talking about multiprocessing and a few others like AR pars and stuff uh and then we'll hop into object-oriented programming uh because objectoriented programming is one of the best ways to make modular code you don't have to use object-oriented programming but it is one of the best ways and it's certainly better than scripting which is most of what we do on the channel so anyways if you have questions comments concerns whatever feel free to leave them below otherwise stay tuned in the next tutorial thanks for watching

Original Description

Welcome to the intermediate Python programming tutorial series. In this series, we're going to be taking the "next steps" after one has become comfortable with the basics of Python, and has been working with it for a bit. Up to this point, my tutorials have all been done using very basic, rudimentary Python. My definition of basic Python: code that is meant to "just make it run." This is fine for beginners, because there's not much point in overloading with nuances (most people wont retain it, since they don't care, at least I didn't when I was starting out). I define intermediate Python code as: Modular - Easily used by others and/or in other projects by you or others. Basically, write code with the intention to honor DRY (don't repeat yourself). Maintainable - ...Both by the original author and by other users. Is it easily read-able and understood? Scales - For this to happen, code needs to be efficient when it runs, and be able to scale. Think about reading files, working with requests, or doing calculations. Maintainability also plays a major role in scaling. In general, code that meets the above standards in Python is done with the Object Oriented Programming (OOP) paradigm. There does exist another paradigm, called Functional Programming (FP), and there are bloody wars fought over which is better. We're going to use OOP. Either one of these is better than outright scripting, which what most beginner programmers are really doing. To begin this series, I am going to teach a few basic standard library functions and functionalities of Python that will replace otherwise bad habits in programming, before getting into Object Oriented Programming and design. https://pythonprogramming.net/data-analysis-python-pandas-tutorial-introduction/ https://twitter.com/sentdex https://www.facebook.com/pythonprogramming.net/ https://plus.google.com/+sentdex
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from sentdex · sentdex · 0 of 60

← Previous Next →
1 Matplotlib Python Tutorial Part 1: Basics and your first Graph!
Matplotlib Python Tutorial Part 1: Basics and your first Graph!
sentdex
2 Python Encryption Tutorial with PyCrypto
Python Encryption Tutorial with PyCrypto
sentdex
3 Python's Logging Function
Python's Logging Function
sentdex
4 wxPython Tutorials 1: Making Windows GUIs with Python : Installing + 1st window!
wxPython Tutorials 1: Making Windows GUIs with Python : Installing + 1st window!
sentdex
5 wxPython Tutorials 2: Making Windows GUIs with Python: Customizing Window Parameters
wxPython Tutorials 2: Making Windows GUIs with Python: Customizing Window Parameters
sentdex
6 wxPython Programming Tutorial 3: Menu Bar and Menu Button
wxPython Programming Tutorial 3: Menu Bar and Menu Button
sentdex
7 wxPython Programming Tutorial 4: Panels
wxPython Programming Tutorial 4: Panels
sentdex
8 wxPython Programming Tutorial 5: User Input Saved To Variables
wxPython Programming Tutorial 5: User Input Saved To Variables
sentdex
9 wxPython Programming Tutorial 6: Multiple Choice Input
wxPython Programming Tutorial 6: Multiple Choice Input
sentdex
10 wxPython Programming Tutorial 7: Adding Static Text and Colors
wxPython Programming Tutorial 7: Adding Static Text and Colors
sentdex
11 wxPython Programming Tutorial 8: Custom Button Images
wxPython Programming Tutorial 8: Custom Button Images
sentdex
12 wxPython Programming Tutorial 9: Tool Bar Items and Sub Menus!
wxPython Programming Tutorial 9: Tool Bar Items and Sub Menus!
sentdex
13 Basic PHP Tutorial 13: Multi-dimensional Array
Basic PHP Tutorial 13: Multi-dimensional Array
sentdex
14 Basic PHP Tutorial 15: Functions and Global Variables
Basic PHP Tutorial 15: Functions and Global Variables
sentdex
15 Basic PHP Tutorial 12: Associative Array
Basic PHP Tutorial 12: Associative Array
sentdex
16 Basic PHP Tutorial 14: Foreach loop
Basic PHP Tutorial 14: Foreach loop
sentdex
17 Basic PHP Tutorial 16: Include and Require
Basic PHP Tutorial 16: Include and Require
sentdex
18 Basic PHP Tutorial 7: Assignment, comparison and Logical operators
Basic PHP Tutorial 7: Assignment, comparison and Logical operators
sentdex
19 Basic PHP Tutorial 4: Variables and Comments
Basic PHP Tutorial 4: Variables and Comments
sentdex
20 Basic PHP Tutorial 11: Arrays part 1, basic array
Basic PHP Tutorial 11: Arrays part 1, basic array
sentdex
21 Basic PHP Tutorial 6: If else and else if conditionals cont'd
Basic PHP Tutorial 6: If else and else if conditionals cont'd
sentdex
22 Basic PHP Tutorial 1: Intro to PHP
Basic PHP Tutorial 1: Intro to PHP
sentdex
23 Basic PHP Tutorial 3: HTML with PHP
Basic PHP Tutorial 3: HTML with PHP
sentdex
24 Basic PHP Tutorial 9: While Loop
Basic PHP Tutorial 9: While Loop
sentdex
25 Basic PHP Tutorial 10: Switch Statement
Basic PHP Tutorial 10: Switch Statement
sentdex
26 Basic PHP Tutorial 2: Print and Echo
Basic PHP Tutorial 2: Print and Echo
sentdex
27 Basic PHP Tutorial 5: If else and else if conditional statements
Basic PHP Tutorial 5: If else and else if conditional statements
sentdex
28 Basic PHP Tutorial 8: Arithmatic Operators: Doing math with php
Basic PHP Tutorial 8: Arithmatic Operators: Doing math with php
sentdex
29 Basic PHP Tutorial 17: User Input Form Example / String Manipulation
Basic PHP Tutorial 17: User Input Form Example / String Manipulation
sentdex
30 Basic PHP Tutorial 18: HTML Entities and forms cont'd
Basic PHP Tutorial 18: HTML Entities and forms cont'd
sentdex
31 Basic PHP Tutorial 19: Finding words in strings
Basic PHP Tutorial 19: Finding words in strings
sentdex
32 Basic PHP Programming Tutorial 20: Saving to a File / writing and appending
Basic PHP Programming Tutorial 20: Saving to a File / writing and appending
sentdex
33 Basic PHP Programming Tutorial 22: Hashing part 2: salting
Basic PHP Programming Tutorial 22: Hashing part 2: salting
sentdex
34 Basic PHP Programming Tutorial 23: Variables in Strings and tokenizing
Basic PHP Programming Tutorial 23: Variables in Strings and tokenizing
sentdex
35 Basic PHP Programming Tutorial 21: MD5 Hashing For Security
Basic PHP Programming Tutorial 21: MD5 Hashing For Security
sentdex
36 Basic PHP Programming Tutorial 24: String similarity
Basic PHP Programming Tutorial 24: String similarity
sentdex
37 Basic PHP Programming Tutorial 25: Time and Time stamps
Basic PHP Programming Tutorial 25: Time and Time stamps
sentdex
38 Basic PHP Programming Tutorial 26: Die and Exit
Basic PHP Programming Tutorial 26: Die and Exit
sentdex
39 Basic PHP Programming Tutorial 27: MySQL Databases Part 1
Basic PHP Programming Tutorial 27: MySQL Databases Part 1
sentdex
40 Basic PHP Programming Tutorial 28: MySQL Database Part 2: Reading From Database
Basic PHP Programming Tutorial 28: MySQL Database Part 2: Reading From Database
sentdex
41 Basic PHP Programming Tutorial 29: MySQL Database Part 3: Inputting Data
Basic PHP Programming Tutorial 29: MySQL Database Part 3: Inputting Data
sentdex
42 Basic PHP Programming Tutorial 30: MySQL database in Use
Basic PHP Programming Tutorial 30: MySQL database in Use
sentdex
43 Django Tutorial Web Development with Python Part 1: Installing Django
Django Tutorial Web Development with Python Part 1: Installing Django
sentdex
44 Python Tutorial: File Deletion and Folder Deletion / directory deletion
Python Tutorial: File Deletion and Folder Deletion / directory deletion
sentdex
45 Python Tutorial: How to Rename Files and Move Files with Python
Python Tutorial: How to Rename Files and Move Files with Python
sentdex
46 3D Graphs in Matplotlib for Python: Basic 3D Line
3D Graphs in Matplotlib for Python: Basic 3D Line
sentdex
47 3D Plotting in Matplotlib for Python: 3D Scatter Plot
3D Plotting in Matplotlib for Python: 3D Scatter Plot
sentdex
48 3D Charts in Matplotlib for Python: Multiple datasets scatter plot
3D Charts in Matplotlib for Python: Multiple datasets scatter plot
sentdex
49 Sikuli Tutorial 1: Visually programming in python!
Sikuli Tutorial 1: Visually programming in python!
sentdex
50 Sikuli Tutorial 2: Program visually in python!
Sikuli Tutorial 2: Program visually in python!
sentdex
51 Sikuli Tutorial 3: Program visually in python!
Sikuli Tutorial 3: Program visually in python!
sentdex
52 3D Bar Charts in Python and Matplotlib
3D Bar Charts in Python and Matplotlib
sentdex
53 3D Plane wire frame Graph Chart in Python
3D Plane wire frame Graph Chart in Python
sentdex
54 Raspberry Pi Part 1 Introduction
Raspberry Pi Part 1 Introduction
sentdex
55 Raspberry Pi Part 8: First Download and Update! (Firmware)
Raspberry Pi Part 8: First Download and Update! (Firmware)
sentdex
56 Raspberry Pi Part 10: How to set up a Linux Web Server on your Pi
Raspberry Pi Part 10: How to set up a Linux Web Server on your Pi
sentdex
57 Raspberry Pi Part 11: Remote Desktop
Raspberry Pi Part 11: Remote Desktop
sentdex
58 Twitter Analysis: How to rank a user's influence
Twitter Analysis: How to rank a user's influence
sentdex
59 GPIO Tutorial for Pi Part 2 - Programming the GPIO
GPIO Tutorial for Pi Part 2 - Programming the GPIO
sentdex
60 GPIO Tutorial for Raspberry Pi Part 1 - Setting up
GPIO Tutorial for Raspberry Pi Part 1 - Setting up
sentdex

The video introduces the intermediate Python programming tutorial series, covering topics such as efficiency, maintainability, and modularity, with a focus on standard library, object-oriented programming, and best practices like PEP 8 and the Zen of Python. The series aims to help viewers improve their Python skills and write better code. The video also encourages viewers to contribute to the series and share their own ideas and methods.

Key Takeaways
  1. Understand the importance of efficiency, maintainability, and modularity in Python programming
  2. Learn about PEP 8 and the Zen of Python
  3. Apply best practices to write better code
  4. Use standard library and object-oriented programming to create modular programs
  5. Contribute to the series and share own ideas and methods
💡 The Zen of Python is a set of principles that can help guide Python programming and improve code quality, and it's more important to adhere to these principles than to follow PEP 8 strictly.

Related AI Lessons

Up next
How to Open HPL Files (HP-GL Plotter)
File Extension Geeks
Watch →