Python is downright awesome for a beginner, due to it being more readable and there not being a mountain of frameworks that all seem like completely separate languages. Not only that but there are amazing tools that enable a beginner to just jump right in and create.
Python is learnable to the point that even people outside of software development are using it as a tool to automate annoying manual tasks. Scripting away all the hard repetitive tasks at work until everyone thinks they are some kind of wizard.
One of the tools mentioned in the podcast is the wonderful Cookiecutter Django. A great tool for beginners who don't want to deal with a million installs and an array of different skills just to get a project deployed.
The other tool mentioned, The Jupyter Notebook, gets python up and running right in your browser. Inline code and rich text documentation allow you to write code and see the results inline, even giving you the power to write documentation around the output.
Check out Will's new egghead course, Intro to Python, and jump into this rich, beginner-friendly world.
Will Button: Yeah. My name's Will Button. I work with tech startups on scaling automation and currently working with Active. I've been working with Python for a few years now and have used it in all sorts of interesting applications as background scripting engine for servers, for a deployment process, lots of ETL tasks and some websites, and even done some cool stuff with it in AWS Lambda.
John Lindquist: That's a wide variety of stuff. Miller, go ahead.
Miller Hooks: Yeah. I'm Miller Hooks. I am a software developer. I've been doing it for 15 years. About 10 of that's with Python. A lot of GIS mobile development, RESTful interfaces. In the last few years, more machine learning, SciPy, NumPy and I'm an engineering manager over at Graphistry where we have a really great Python library for doing interesting visualizations.
John Lindquist: Will were you going to say something?
Miller Hooks: No, Django has definitely broken some rules as it's evolved into what it is today. For the most part, one of the ways that Python is designed is that it is very assessable on the surface because it reads like English and it's very functional but it goes as deep as you wanna go. It doesn't have that context switching really anywhere in it. There's been a lot of care to maintain that for sure.
John Lindquist: Let's do a comparison like, developing a node versus writing the server or whatever in Python. What do you find so appealing about Python in those scenarios?
Miller Hooks: Well for me, they really work in tandem but I live server side Python. If there is a server side task, if it's data based interfacing or operational scripting, Python is where I go to. Node is getting a lot better, I was just introduced to Lerna the other day and using that is now going to be a part of my server side operational stuff. Python as is, either 2.7 or Python 3 hopefully, is on almost every system. It's just as available and reliable as Bash probably is.
Miller Hooks: The early days of Node and NPM, specifically things like versions were really, really hard to work with and manage and through the original predecessor to NVM actually used Pythons virtual M to make versions of Node and I think their package manager takes lots of cues these days from ground that was set up by PIP after easy install. It really is, I would say even in the last six, seven months as the new Angular stuff and the eco system is maturing, they are starting to look similar but I couldn't say the same thing a couple years ago.
Will Button: Yeah, I think using PIP for deployments and just managing your dependencies is so much easier using Python and then just ease of deployment because, like Miller said, Python's already out there and it's just ready to go. The deployment process has a lot less friction, which isn't necessarily true for Node on the back end.
John Lindquist: Yeah, I think some people listening to this podcast might not know that your OS probably has Python on it, right. Any time you wanna start with a Node project, you have to first download and install Node, or include it in some sort of bundle or something.
Miller Hooks: I introduced my girlfriend to the Python interpreter, and I didn't realize she had a Netbook, but she was able to get it installed on her Windows Netbook and run through, learn Python the hard way, which that's really, really the hard way. I was really proud of her for getting after that. I had to open up the computer to realize it did not have a hard drive but it's still there, and just you can open up the interpreter, and walk through the lessons.
John Lindquist: Yeah, I 100% agree with that. You mentioned versions. I haven't touched Python in a little bit, and I know Python 2 versus 3 had been a thing back when I used it last. I think it's still a thing, right?
Miller Hooks: No, not really. Python 3 is everywhere. If a package hasn't upgraded, it's probably because it's dead and we even have a tool that comes with Python 3 that will convert a project for you, and lint it, and let you know if anything you need to address directly. So even a large project can be converted almost instantly. It also will help you if you have specific context switches, that it might be deployed on both, to be able to work with that. But largely, the entire ecosystem of anything that's even slightly actively used is imported.
Will Button: I think the only you still see Python 2 anymore is just in a case where people ... I think CentOS and AWS Linux still default to Python 2, and so if you have someone that doesn't know, or hasn't been experienced with Python, they may end up running Python 2, but those are pretty few and far between and Python 3 is just ready to go and everything is set up for it on almost all the modern OS'.
Miller Hooks: It's very good at error readability as well, which was always one of my biggest ... when I first started doing Node was ... and I'm still unimpressed at the signal-to-noise ratio and error messages, even though it has been getting steadily better with the newer versions but if you are running the wrong package on Python, you've got four or five lines that are gonna be pretty clear.
Miller Hooks: I would say especially to the audience for this podcast that you'd be hard to be Django, and Django REST Framework for your backend. There's this great tool called Cookiecutter that has an intro Django, and there's a decent advanced one by Pydanny that literally with just one command, Django Cookiecutter, you can ... it'll ask you a handful of questions and it'll deploy you Django with Django REST Framework in and an angular setup, so you've got an API, and you can set it up for Heroku or Docker deployment.
John Lindquist: Right, and it has an admin section where you can just go in and ... with the GUI.
Miller Hooks: As we're gonna change our database tables, and you don't want to think about that, and you want to be able to roll them back and roll them forward, and that's built into the application so you can be adding or removing tables, doing data entry through the admin, creating fixtures for that data so you don't lose it and redeploying it very, very quickly.
John Lindquist: I think basically anything database related is better in Python with my experience. I remember just plugging in database names and table names as a string and then it just worked and in node, we'll have to install, this thing, that thing, that thing and then wait. What's this one? What's that? And, yeah.
Miller Hooks: I found Django 9.6 after I was Drupal developer. I'd been doing PHP for most of my career so it was quite a while ago. Drupal and WordPress and one of the largest automated attacks in history happened at the time and all of my websites were compromised all at once, and it was replaced with a man with a sword and some scary chanting music and all of my clients were sad and I mean, it's because the eco system of WordPress and PHP are huge attack factors, extremely vulnerable and it was very, very scriptable.
Miller Hooks: I had been looking at other Python frameworks, a friend had shown me the interpreter and then I found Django and as soon as I saw that ORM, I never looked back. I've done a little bit of WordPress since but I was able to port my customers over easily and I wasn't even proficient at Python.
John Lindquist: That's a great story. Will what are your thoughts on-
Will Button: I think that's one of the cool things you can learn from Django if you haven't been programming a lot, if you're just getting started with programming. Firing up Django and going through that process, it actually exposes you to a lot of things that you may not even realize or things you should be thinking about like the schema migration and how easy it is to get an admin interface up.
Will Button: It's a way to quickly and easily start testing out your idea, see instant results but at the same time, learning about some of the higher level concepts that are gonna be important for you to know as your project progresses and becomes more advanced.
Miller Hooks: I would recommend the IPython notebooks, which are called Jupyter notebooks. Jupyter with a Y. If you have Docker installed on your computer, you don't have to know anything about Docker, but you can go look up the IPython notebook for data science NumPy, SciPy or just Python and you run one command, and it pulls down this container that gives you the IPython notebook is a web address, you can just browse through it in your browser, and it saves a specific type of file called Py ... I don't know. It's got a couple of letters in it but it's a ... it gives you a web interface where you can chunk out different cells of Python and hit run right there in the browser.
Miller Hooks: You can switch between two or three, you can have access to the data science tools, you can open up a terminal in the browser and install new packages with PIP. Without configuring your interface or your computer, you can get in and use some data science tools that otherwise you wouldn't have to and I think this really couples well with starting to learn because you can spin up an IPython notebook instance right there on your computer, you get this webpage that works just like a notebook and then you can open up learn Python the hard way and just go and work through those exercises and you can just replay each cell and then you can open up a new one and play with some of the harder tools, which leads itself right into being able to set up a Django site easily.
Miller Hooks: It's just an amazing set of tools. I use it all the time when I need to scratch pad something. I just open up the container and play around with it.
Will Button: That's great. One of the cool things I like about that as well is you can have not only your Python code in there, but you can also have documentation in there. You can add markdown or HTML and so you have this little running transcript of here's the chunk of Python code, you can run it and then just have the documentation of this is what we expected the outcome to be or here's what we're gonna do next with it and then another chunk of Python code and it's actually been really helpful for me, working with finance departments because they question everything, they question every assumption.
Will Button: Where did you get this data from? What assumptions did you make in cleaning the data? How did you model it out? And you can just create this whole beautiful step by step interactive document to give to them and they can reproduce your results and see the documentation in line with it.
Miller Hooks: NVM for sure because it started out as that and the isolation that comes with that I do believe is fairly Pythonic.
Miller Hooks: One of the jokes with Python is that it's self-documenting because the code is the documentation obviously, auto doc is still important, but it does just read. If you have a problem you can just jump in there where it can be a little esoteric in most other languages.
John Lindquist: Is there any concrete examples you could give of that? Some put a comparison between what in Python ... what does a call back look like in Python?
Will Button: You just don't have them. If you write a function that has to go off and query a server and return results, you just handle the results on the next line because the code doesn't progress until that line of that code above it completes.
Miller Hooks: Async Python is pretty cutting edge and people that are really looking for an asynchronous Python experience, if you're really interested in digging into the nuts and bolts of Python, look at the debate about the GIL which is-
John Lindquist: The GIL?
Miller Hooks: GIL yeah, the Global Interlock, which is why Python doesn't do asynchronous well. We have some async tools and there is a project called the GIL-ectomy about removing this I think the Global Interpreter Lock from Python, so it can work concurrently and one of the debates about that is if you need concurrency, then we have Rust and Go and those play fine with Python but traditionally, the async tasks that are some of the hardest things in other languages because they inherently involve not really knowing what's going on on the other side, Python avoids for the most part.
Miller Hooks: If you've got a bunch of async calls in your Python, either you know what you're doing or you're very frustrated.
John Lindquist: Yeah, I can get that. One thing I've noticed with Python is one of my friends, she's a ... she does data entry and as part of her job, she had no experience programming whatsoever and then as part of her job, just as she got into it, they were like, "Well, is there any way to automate any of these things?" She was introduced to Python through just automating her daily routine data entry points and similarly, I have another friend who's working on his engineering degree where they needed to compute some sort of physics whatever, I'm not into Math and the first thing he turned to was Python because that had the best Math libraries for calculating all these interactions in the physical world.
Miller Hooks: Over the last few years it really has become the darling of data analysis. It started in academia but now it's moving into big data which before had preferred things that were more esoteric and that has a lot to do with IPython notebooks and a project called Pandas and then also the readability and accessibility like we were talking about the ability to share these things but I use Python every day to script out annoyances. If I have to repeat something too much and it's complicated, I open up some Python and if I'm on a new job or something, I automate the hardest parts of it with Python fast and that's because-
John Lindquist: Give me a good example of that. What's something you've automated?
Miller Hooks: Sure. I was at a large video streaming company and they were an entirely PHP shop and everything had to be routed through a VPN and the VPN was all the way to Luxembourg and it would go down a lot and one of the things ... They said it was basically impossible to do local development using Docker and a few other things, I was able to get that going but a constant problem for me was this Mongo service that I didn't have access to but it relied on through the VPN.
Miller Hooks: Through some man in the middle attacks on my own stuff, I was able to dump that data, parse it and create a fake service but there's easier day to day tasks like for instance, you have a ... someone gives you a giant spreadsheet and you could load it into Google Docs, the G spreadsheet package for Google Docs. If you've just got a quick ... You don't even need an API key, Google gives you a special email address and you dump that as the string. You open it on IPython notebook and then in that IPython notebook, you now have access to that total ... that Google sheet where you can reference the columns by name and if you start playing with Pandas or any of the libraries there, you can parse all that data out and do exactly what you need and then from Python, you can have ... just make a separate cell with a play button that will push that out to a CSV or your other server.
Miller Hooks: That's without knowing anything about network infrastructure. You can automate a task that would be manual. A lot of hidden data in and out of spreadsheets that we deal with on a daily basis can be very kludgy.
John Lindquist: That's so cool. I take that for granted so often. Just the automation of simple spreadsheet things that my parents try and deal with all the time and just waste so much time with and-
Miller Hooks: So much of large enterprise operations run on two women above 70 years old sitting in a room with dusty books and spreadsheets and hold all the institutional knowledge and a lot of it is emailing spreadsheets around and when you really get into those businesses, a lot of their cost are out the window for that. Now, we do have tools for that sort of thing and at any new job, that's the first thing I look for is ways I can script easily the hardest parts and then just let people know that I'm very efficient and they don't have to see the scripts, they just think I manage it.
John Lindquist: Sounds like you should charge more.
Miller Hooks: I do okay.
Will Button: I think that's a [inaudible 00:26:37]. One of the things that you can do is that any time you have this daily repetitive task, if you have to move this file or copy and paste this data or run this report they're all tests that can be really easily automated by Python and a great learning experience to. You can take this task and you can automate it and then the deployment of it makes it easy because Python is gonna exist somewhere in your environment where you can push that and just have it run every day and completely automate that task away and it's pretty amazing when you dig it's pretty amazing when you dig and just do a little bit of research.
Will Button: The libraries that already exist for Python that read spreadsheets or write spreadsheets or send emails. All of those daily tasks that people build their whole jobs around can just be automated away.
Miller Hooks: I don't know how many times before I really discovered the power of Python, how much time I would spend with things like figuring out how to parse things like figuring out how to parse CSV and figuring out how to parse CSV delimiters. Who really needs to hold that knowledge in their head [inaudible 00:27:42]? A good tool for intro to just that process. People are looking to use that as kind of an entry way into ... it's called Fabric. It's a Python library you create as fab file py and I do this in just a working directory and kind of similar to bash.
Miller Hooks: You can just execute commands in the terminal with it and you create functions with them and then you just end up with little keyboard shortcuts. So, you do fab, the name of the function and you can set it up to execute remotely or locally, it can access other servers and it's continuous integration to use a big annoying word but at a level that's really accessible. You don't any infrastructure and I'll use it for producing reports for people. I think that's a pretty good swath on what it is and what the introduction is.
John Lindquist: I think for our audience it's pretty much ... I don't like to go too deep into-
Miller Hooks: I can annoyingly talk about really esoteric stuff but everyone in my life has told me to stop.
John Lindquist: That's for listening. For more information, check out will's intro to Python course on egghead.io.