Python Decorators and Writing for Real Python | Real Python Podcast #1
Key Takeaways
The video discusses Python decorators, writing for Real Python, and the background of Geir Arne Hjelle, a Pythonista and PyCon speaker, with topics ranging from decorators, data classes, and context managers to interactive debugging and the Real Python community.
Full Transcript
welcome to the real Python podcast this is episode one and my name is Christopher Bailey your host and this week I have a conversation with gana on yella one of the author's here at real Python we talk about Python decorators and his background do a little bit of introspection to discuss the real Python editing process then we talked about some of the articles he's written for the site and touch on his talk at PyCon last year one programming note in this episode we discussed PyCon u.s. 2020 the episode was recorded at an earlier date and at this moment PyCon u.s. 2020 is looking at its options for rescheduling or a potential cancellation I'll continue to give you additional updates on Pyke on us in upcoming episodes as we find out more information and now here's episode 1 so let's get started [Music] the real Python podcast is a weekly conversation about using Python in the real world interviews with experts in the community and discussions about the topics articles and courses found at real Python comm after the podcast join us and learn real-world Python skills with a community of experts at real Python comm hey welcome to the podcast so were you joining me from I'm in Oslo in Norway so on the other side of the planet I'm here in Colorado mmm where it's currently snowing we were talking earlier about weather right yeah kinda envious of your snow but well probably guess I'm here as well don't you start off by telling us a little bit about how you got involved with Python and then eventually real Python right um yeah so if I'm kind of going all the way back first for some background I have been coding essentially forever because my dad got a Commodore 64 when I was a young boy and I think he just went to play games on it but I figured I could do a little bit of basic on it and then I kind of got coding when I was like eight nine years old which was has been a big gift to kind of have that possibility and then I had a brief interaction with Python at a summer internship about 20 years ago now I guess but that was Python one six I believe and Wow for some reason I think it seemed complicated I don't know why but I think it was just that sort of like the lack of structure that I was used to at the time from Java and these kind of things he kind of had the the main entry point and so on so I put it aside for many years and then 2012 I think you kind of got a little bit back into it then I was totally blown away by how quick and he said was to write the think the first project was a small parser that we wanted to essentially create a report p8 PDF report from some thing and it was I kind of set aside this would take a long time but then in two hours and we were done and it's gonna oh that's it this is fantastic nice and so then I've kind of been using it more and more and I changed jobs back in 2014 I started working for now region mapping authority and they're kind of getting into a whole project that was using Fortran but we then essentially started rewriting it and started using Python for that so then I really got deep into Python and we did all kinds of stuff from compiling some Fortran to stuff we could read from Python this essentially got Fortran into Python modules innocence and then doing a lot of the numpy work to Caribou get this thing to to run around that gave me a lot of experience with Python which was really cool and I just get got to love it more and more it's nice to be able to convert something that's already existing and have a direction you're headed in and is the company using any Fortran anymore at least for this project we pure Python now so and it so that was very nice it kind of got rid of essentially two hundred thousand lines of Fortran code or something like this that's a lot that's a lot lot lot into something that's much easier to handle in Python so that was a fun project to work on then I guess it's about two years ago now yeah early 2018 I heard then Bader was on the think it was the Python bites podcast where he announced that he had or mentioned that he had kind of taken over the real Python website and I already knew Dan a little bit from his newsletters and then in one of the newsletters is essentially said do you want to write for us send me a note and I did send this quick note and got an answer and essentially got what we typically do for rare people coming in as authors is giving them a trial article to write though that's kind of your how to get into the team so I picked an article about path lip which is this very nice library for working with pets and yeah I guess it came in and Python three four so it's starting to become quite all-in-one and I hadn't used it too much then but I figured this would be a good exercise in getting to know the librarian and so on I just had a few experiences with which were very good then I was kind of working through that article and I remember I was actually in a cabin in the mountains in actually northern Sweden when I got a message from that saying that he really liked the article and welcomed me I'm on board a team so that was that was fun so since then I have guests I written something like seven or eight articles Pannell that's great I've gotten to write quite a few articles and then now I'm also been working on the team and doing tech reviews for other articles so essentially I guess we should at some point explain the whole publishing hypermedia yeah what's up the pipeline look like you know where does tech review fit in so it started when when I first wrote the first article that was quite early so I it was essentially Dan was reviewing my article giving some notes and we were backing forth a little bit but since then it's kind of grown I'll often the set up a full pipeline so we have an editor joanna Jablonski who is kind of still doing a lot of stuff but then during the pipeline we we also offload some of the responsibility to other people on the team so the pipeline now is essentially that you or we first write an outline or an article and then that's being reviewed you get some comments on it then you go off and write the first you write the article essentially and once that's done it's sent over to another team member for a technical review where we kind of make sure that the technical aspects of the article makes sense and then it's passed on to a didactic review where we kind of consider that the article is something that would be useful for people to learn from and so on can we make this how can we best address the readers in and make sure everything is understandable and then finally there's the stage where do a language edit so kind of clean up all them yeah in my case all the commas tend to move around at the language at its sheriffin well I've pretty sure that comer will so different in original English because they still can't really wrap my head around that part so it's quite a process but that's kind of been one of the really cool things with getting involved is this was that I didn't really expect this how much I've been learning my both about how to write and about Python itself of course and then getting to know all the people on the team and so on so it's been a really rewarding commitment innocence so I am so as I mentioned I'm doing some tech reviews but then the last year or so I've been doing most of the outline reviews that real Python as well so which is really cool because then I get to communicate a little bit with all the new authors coming on board and I get to kind of see most articles before almost anybody else so that's also been a lot of fun to do and we do these reviews so the upland review and the didactic review typically do us videos so we kind of sit down so I typically make a video that's probably 10 to 15 minutes long for each outline and kind of talk through it help the readers along a little bit come with some ideas for how how to structure things and so on are you showing say the wording of the outline as you're going through that or is it just you yourself like a look on a screen capture yeah no so you do or do a screen shot essentially looking at the outline commenting all the different things so okay me I'm ugly I'm ugly audio but yeah yeah I am I have a similar path in the sense that I got introduced to Dan's work through his Python tricks book and I think he was on again one of the other podcasts probably rock python talking about that book and so then I joined the newsletter of same kind of deal and then he was looking for people to do video courses about this time last year and I have a background in teaching for gosh over ten years and a background in like Final Cut Pro and was just kind of getting into Python I had maybe a year under my belt in Python I had been using sequel and a load of data science and R and a platform called FileMaker Pro and so I was super excited with the idea of like okay like you said this is a really awesome way to learn and sometimes teaching is one of the best ways to learn a new topic and you know have to really explain it to somebody else in that way and so I've really enjoyed that process and in kind of a similar way I had to create a pilot I created my first of course was a pilot course on requests and over the last year now I'm kind of in the process of in my own reviewing I'm reviewing the courses as they're created by the other video course creators and so I kind of get to see them like you said in sort of a raw form and provide feedback and try to help people wash them up and all this in some ways is helping dan kind of continue to you know spend many plates in other areas so the team kind of grows and which is working out really good I think ya know it's been a lot of fun to see to see the growth in how Danis always something new happening there so and yeah I must admit that I didn't hear too much about the video team before you guys were kind of on and I think yeah one of my first experiences which were really cool was think when we were yeah parently not the first but one of your first videos was the one about decorators yeah yeah that's what we're here to talk about too and I didn't even know this was being made until it just popped up there and then I kind of oh that's interesting I want to see see what this is about and then you had essentially converted my article then into into a video which was a lot of fun to kind of just essentially see my words made into videos come out of somebody else's mouth right yeah lots of highlighting and yeah it's it was I really liked working on on your stuff actually I think it's ER we've had three collaborations yeah now sort of through the different different courses in articles right yeah yeah and I I couldn't get it couldn't quite fit all of the article into my course I have to go back and look at the actual total length but but yeah it's like it's kind of neat you go away into some really great depth so somebody wants to dip their toes into it they can really get an idea of like okay you know this background of what decorators are and then kind of keep stacking on top additional levels if somebody wants to keep going and go deeper into it so I really like that about it right yeah I guess a little bit of background cuz I think that was my third article third of actually fourth article that was published cuz yeah we rushed in a Python 37 in the middle and it was an article that already existed on the site before Dan took over who is the original author on them oh I think it's Michael Herman that did it okay it was one of the founders the real Python yeah and but yeah I haven't seen exact kind of credits for the old stuff but I think that was his I remember it was a very neat article already and it has a very nice introduction into essentially how decorators are really just functions applied to functions that's essentially what they do and had a nice explanation of how inner functions work in these things that you kind of need need a background for yeah that's all those things that I think is really crucial like yeah the concept that you know to give people a background on it I know that I had seen the syntactic sugar of the at symbol just kind of going through tutorials on my own and trying to learn things like flask or Django or other places and going okay I'm not sure what that symbol means and what's going on inside there and so that's why I really wanted to jump on yeah getting into the weeds and learning all the different details of it so yeah cuz I guess the characters are this kind of interesting feature where they they feel to some extent natural in that you can kind of understand what they mean for instance if you have a say a property inside of a class there's just this word saying property on top of it so it means okay this is probably a property or with the flask I guess you have the login required decorator that kind of just sits it up there so it kind of makes sense what it's supposed to do but how it technically works this is a whole lot of story right yeah it's such a neat tool to be able to reuse code and not not have to in the case of some of the examples given in the tutorial or you're going in and showing a reusability of something like a logger or timing functions or slowing down code I think that's really really powerful yeah but I actually thought about the other day I was a little confused myself again having not had as much time in a nun been reviewing a lot of courses that are about object-oriented stuff lately and I really wondered about that property decorator and you know the difference between an attribute and converting into any property is you really get the ability to add those getter and setter sort of customizable methods as opposed to any kind of data coming in you could clean what's coming in when you go to set something a test for things gonna give it a class about a car and yeah an attribute that was like you know storage space or something like that somebody could just change that and assign it to a negative number which wouldn't really make any sense and so right by then turning it into a property when you go to set that value it could respond back and say well that's actually you know invalid that wouldn't work in this case you can't have a you know negative value in this car or something all right yeah and I think if you're kind of coming from languages like Java where you have explicit getters and setters yeah the property is exactly that for Python and I kind of like that the way it's implemented is it's very it's it's not the truth of it all and it kind of gives you the opportunity to kind of easily switch if you have an attribute that you start out with but then you realize I really need to for instance as you say restrict certain values so I should take care in my cellar that totally certain values are allowed then you can just add this property instead so change your attribute to your property and all the code stays the same on the outside but you get this extra future really clean yeah so you can kind of refactor later instead of in in Java you typically make your getters and setters in case you need them with a lot of templating code while in Python you can kind of no just use the attributes as long as they're good enough and then in change later if needed so I really like that model it's nice about Python in that sense at a basic level you can really you know like you said very quickly structure something and then you can add the complexity as you go and that's one of the things that I kind of liked about it yeah you don't have to just you know comparing like something simple like hell worlds between you know Java and Python yes so it's so amazing hmm when I started planning this interview with you I ran across this talk that you'd done icon 2019 right and it was about plugins yep you want to go over what you were talking about there yes this is essentially something that I kind of worked out a little bit for myself but kind of kind of like probably too - too much too abstract code a little bit out then and it's essentially or especially things like keeping things that should be configurable outside of the code itself so I can easily change them and one thing better can I ended up doing in many of our project is that say I want to run on a test different models for instance so currently I'm working on a soccer app and I want to do different models for modeling modeling a shot and then instead of kind of needing to hard-code into into the code itself out to do stuff it's nice to just have a config file that that could even be triggered by some options that kind of says okay use this model or that model and so on and what that kind of translates to on the back end is that I want to be able to run different different methods or different functions and of course you can do this by putting all your functions into a dictionary and then kind of doing this patch from that or or something like that but that suddenly means that you need to maintain a list of which functions are available and you can end up with then writing in the function name several places so after a while when I discovered decorators in Python and figured out that could use a decorator to add stuff automatically to the dictionary that I can dispatch from so essentially instead of having a decorator to actually changes my function I just have a decorator that can register that the function exists so that's what I essentially then call a plug-in is a function that is registered somewhere and then I can just go through and for instance read method names from a config file or from options and things like this and then I can dispatch to the functions based on that and this is at least to me it really works as a very nice general kind of way of structuring my programs and I'm been very happy with that way of yeah working the talk on Python last year was essentially a quick example of how how that is set up and showing then believe that was I did a quick example of a plotting tool that could clock different file types with different plots so we kind of have yeah they needed different readers data readers that were able to dispatch based on the file name and then you can okay so like if you had an excel file versus just a straight CSV or a text file or something right exactly so it's a CSV file you use probably pandas read CSV and then for Jason you can use the built in Jason library and things like this okay great nice so that's something that I yeah I use it for all my work essentially I have created a small package which it's still not properly documented so I haven't really been showing it off too much but it's called PI plugs which is then essentially has this register decorator and and ways to dispatch from that yeah that's a really effective way of working when you did that targets I'll include a link in the show notes to it because it's available on YouTube right yep and then do you have additional resources that you shared with the audience or the participants so the talk was essentially just the live coding through through the example okay and all my notes and the code that was there I have on my github page as well so I have yeah github okay yeah you learn to slash talks oh okay yeah we can again include links to that stuff too yeah so I actually just registered for app icon a couple days ago so I'm gonna be going to Pittsburgh this year I'm super excited about and while I was doing that I noticed your name again yes on there and looks like you're doing a tutorial this year yeah that was really fun to to get accepted for that so I yeah I proposed a tutorial on decorators and so that would be a lot of fun to to work out so it will be I guess fairly similar to the article and going into starting off with some of the basic decorators and then moving on to to the more advanced stuff so first think I have just looking at my notes here for what I was saying yes I'll probably talk a little bit about things like how to just get started with the I think the hello world of decorators is often the timing decorator it it's so nicely into into this way of working right but then kind of yeah and also how I do the plug-in stuff but then also more advanced stuff like your runtime type in type enforcing and those kind of things so kind of going through all the different things you can do with decorators again I guess it's nice these things are filmed and I really like all the work they do on Python in terms of getting getting your research there's also - people are not able to attend them so and so it's a very nice place to - are the tutorials are a new thing that they're doing this year and no they have been doing them for quite a few years so the way python is set up is that at least Alaska players it's been two days of tutorials that are before the main conference and then you have the three day so the main conference and then you have a I guess they're doing you in four days of Sprint afterwards where you can kind of help yeah right I think yes it's the last year I was there for the tutorials and the conference in two days of Sprint's and it seemed to quite a few people were going home after two days of Sprint's but it's it's really a meeting place for all this different big project so you if if you're going I would really recommend trying to stay for at least one day or Sprint's as well in and of getting to know some progress some of the big projects there and meeting people and just hanging out it's helping out there it's a little fun cool so how many years have you gone to Park on a pike on us was my first time yes last year yeah and partly well I live in Norway so it's it's a long travel to go there sure and so I mostly been going to my kind of go to conference that I've been going to now five six years this euro scifi the European scientific Python conference which is a also a really nice it's it's much smaller conference a couple hundred people but it's it's a really nice kind of meeting place in a now that have been going there for some years you need lots of friends every time and so on but it also has kind of same structure with tutorials and main conference and sprint although just one day of sprint and so on and but then PyCon I've kind of been looking to and okay it would be fun to go by the it's a long travel and so on but then after I joined real Python and kind of realized that this would be a great chance to meet some of the other authors some of the other team members then I really figured okay I should try to go and that was really a highlight last year was kind of seeing these people that I mostly know through slack jets and yeah and and avatars kind of come alive and kind of saying oh there's there's ten there's Jim there's David there's everybody it was it was really nice and I think this year will be even more real fighting people there so that should be a lot of fun yeah it's dance looks like he's got a booth yeah gonna be nice kind of central hub for us to meet em exactly yeah and probably the most fun stuff we did last year was we also did an open space unreal Python where we just said anybody interested come come meet us and we had something like 50 people join in a room and we're kind of talking about oh wow um both yeah their experiences with real Python but also what they're kind of dare wishes so it was a lot of readers that are kind of what what would they like to see going forward and things like this so that was really interesting and a lot of fun to actually meet the people that you just see in comments in their write things like this yes one kind of really cool thing that knows them on that decorators articles that I think it's a hundred and fifty comments or something like right yeah so there's a lot of great interaction going on there yes and your responses are really great again if you kind of look at them they kind of go back I guess it's five years or something now to back when the original article was first published right until it was I guess we published or updated was last summer no its year and a half ago I guess 2018 so it's been around for quite a while as well in it but I think it's probably one or more popular articles let's see in my stats that it always it's a good visit so that's been a lot of fun I think that was kind of one of the essentially our very salsa when we did it big update was because it was such a popular article how would it work that we actually did this fairly big tweak to it but it seems to have been working out nicely and as you say yeah we got a lot of nice comments yeah on it as well and then one of the things that we did last year after the the video course came out we decided the three of us dan you and me to do sort of a slack Q&A yeah you know about decorators and kind of opened up this whole forum which was really neat and we were able to save it as a downloadable PDF now yeah something kind of neat that we're always adding new things to the site to kind of help add more resources for for learning on these different topics we've just been really kind of fun to help create ya know I really like when we were able to kind of go back to to some our old old gold is in a sense and add even more content around them so from the I guess original article to Canada the more in-depth article to the video to the Q&A and things like this so that's that's always a lot of fun and I guess for this one we don't have a quiz I know I've been talking to Dan a few times maybe we should make one but I've never gotten around to it but that's also some stuff we do at the at the site right so many other articles have quizzes as well which also seems to be a very popular feature with people as well going back to your scifi yep you're a site and yeah the urusai probably what time of year does that mean that's usually end of August this year it will be end of July instead but it's think otherwise it's been and and last week of August so you consider the role that you have at your work to be a like a data scientist or a developer yeah I'm officially a data scientist and I okay try to kind of keep that title and I really love programming but I'm kind of thinking that it's always nice when I can use it as a tool to also do do more stuff with it in a sense at work I work for a data science consultancy called Emma Stone Uxbridge and we're kind of trying to take on different projects where we do yeah data science machine learning and those kind of things so currently I'm working on two different projects one is a soccer app where we're trying to analyze people shooting penalty kicks and another one is where I'm working or for more of an industrial partner that's doing krill fishing in the South Atlantic oh wow two very different projects yeah but it's it's a lot of fun to kind of try the different challenges and so on so for the soccer app is that geared toward particular teams and like coaches helping improve the players or is it something that an individual who wants to improve their own game would use right so it's it's a little bit of both so it's the idea is that it should be something if you kind of look at some of the big games like the World Cup and things like this you'll see that do you have all these fancy graphics and it kind of tells you that Messi is shooting the ball 120 kilometers an hour and things like this right and for this day of course use all these fancy sensors that you can't really use or by yourself typically so the idea is kind of been to see can we get some of that that stuff but essentially for free by just using your cell phone okay so it's it's just an app on your cell phone and then you kind of film yourself with this and it it needs to do a little bit of setup to canal so we know where you filmed from and things like this but then we kind of do a lot of computer vision based tracking of the ball and so on and and are able to calculate the speed and precision of your shots and this can both be used just for yourself to kind of either test yourself if you're improving or play against friends but the idea then is also that it can be used by coaches on teams since I want to kind of try to play your track track people as they as they develop nice it's been a lot yeah it's been a fun project to to work on definitely and the other project is that for helping with fishing or helping with just the overall environment in those areas for the crew yes so it's kind of making improving on the yonder on the fishing process in a sense and one thing is that that they're using a lot of fuel and steam so kind of how can you make that more effective and and so on it's definitely a big thing and then we've kind of been also looking into how can you more effectively find krill which are these tiny little animals in the big sea and I always think of them as far as whales you know right that's like the main thing they kind of you know like a blue whale right yeah so that's actually one thing we've been looking a little bit there's this site that has a couple of GPS sensors placed on whales and then the tracking how the males are moving and seeing if we can kind of learn anything from that and of course the whales really like krill so we kind of see oh yeah interesting he's being in that area maybe we should go there and fish and so on there's all kinds of yeah interesting ways to to tackle these problems and then finally that they have a they have a factory where they kind of process the Creole meal into oil so it's also just optimizing the factory and things like this we're also looking into so your company that you're working for is a consultancy you said yeah and so they just get hired and you get put on variety of different projects and right exactly like you were just recently traveling you were here in the US for a little bit yeah that was visiting the factory and kind of getting to see a little bit firsthand how they're doing stuff and then telling them what kind of things we can do for them and coming up with use cases where it can work on together that was that was really nice workshop last week yeah this sounds really exciting we touched on it briefly about how people that are getting into Python programming have seen decorators in use right and don't really have an idea of really what's kind of going on behind the scenes yeah and maybe our just you know repeating the code and a great way to kind of get into them is to really see the the concept of okay the idea that a function is actually just another object and then can be passed in as as an argument or as a parameter into another function is really initially kind of mind-blowing for a lot of you know programmers kind of getting started out this idea that okay well you know I I don't really ever think of like you know functions being passed into functions right but like you were saying a moment ago with your plugins how the idea that you know you could actually put functions into a structure such as you know a list or a dictionary and be able to call things out of them which is really you know kind of a powerful concept inside of Python yeah which is not really that hard to implement you know once you kind of get the idea of it right ya know once you put up your mind around it it's it's real easy right because it's just another variable or something like this it's getting wrapping your mind around it is not necessarily trivial depending a little bit on your background I guess but yeah and so the idea that you could have this you know pre-built function I guess there's some of them that like we talked about property mmm as a decorator that comes you know in the Python language itself there are other ones that are pretty common to that yeah guess when you're talking object-oriented your property and class method and static method all right and then you have the new data classes from 3:7 are implemented as a decorator those are those decorators okay and so what are examples of those data classes I know you have an article on that right so data classes is something that came with Python three seven it has I guess a back port two three six and it's it's really just a convenient way of defining classes so a daily class once it's defined it's just a regular class but the way you define it is that you just put a decorator on top saying this is a data class and then you just specify the attributes that you kind of want to have and then the init function or init method is implemented for you automatically it puts a nice wrapper on it and it can easily also have it automatically implement ordering methods and those kind of things so it's mainly just a very convenient way of defining a class that I then tend to use for a few different projects essentially I could imagine it'd be really good for data science II kind of stuff where you're you're dealing with these sort of large groupings of data that you need to work through right then I think in some sense the name is slightly misleading in a sense because when I here at data class right to kind of go to the idea okay it's mainly may may be more like a struct of data or something like this that you find in other languages but I find that if you just want to have a truck that's more like a name tuple kind of structure gives you that the data class kind of gives you a little bit more on top other and more flexibility so I found myself often just using it for convenience so actually during the holidays I got published an article about the think it's called the Python timers three ways of monitoring your code and yep and in this one I kind of it kind of starts a little bit with the whole okay we want to have a timer where it can just not not - kind of like the time it see how fast something is but I just want to every time I run my code I want to just log how quickly it ran just to keep a track of it and and see their raced then ways you can do this and if you start quite simple you kind of just call on the one of the timers that come bundled into python and you call it before you're coding after your code and just subtract these things that's fairly easy to do but you kind of had a lot of extra code that may not really have anything to do with what you're doing and it's a little bit cryptic why why do you use this and that and so on so it just takes away from the readability oh yeah essentially so just wrapping this into a class that I just called timer and then have a start and a stop on the timer just makes everything more readable it's still the exact same Hinds essentially you need to do but you get something that's more readable and all right and then if for this class if instead of using a regular class just throw the data class decorator on top of it you you get something that's very readable as well because then you get the wrapper implemented for free for instance and you you don't need to do the boilerplate stuff in the init method and so on so that also just helps with implementation then you can kind of realize that okay I often do this timer start timer end and then some block in between and that's really what's called the complex in Python that you have something some block that you want to kind of tag with something so then we implemented the timer as a context manager as well so that your class can be used in this complex settings where you can do with and then timer and then colon and then you kind of have your block that you want the time and then you don't need to do the start stop things and it's just times the blocks so code instead and again this is something that was quite easy to add to the class then we we also quickly added decorator functionality to the class so it can also be used as a decorator so you can just put it on top of a function that you have and then it that function will always be time to when you when you run it the kind of neat neat way of how in the end it can ends up being what 30 40 lines of code it's it's very short but it kind of shows off then both classes data classes complex managers and decorators together in one in one ties together a lot of your articles right so that one was a lot of fun to do put together in a little bit different from the other ones where I kind of go for instance in depth on the Python decorator where it just kind of tells you enough to be dangerous in a sense with decorators and context managers and classes and so on right right and I'm kind of half joking because about we made this the code available on pi PI so you can install this yourself just pip install coach timing it's called and it's then essentially this forty lines of code that has a 10,000 a word documentation article to it so it's probably the most documented code um - I guess there you go you get more of the you know the why write and the implementation and all that not get a lot of good background so that's good yes no actually just the other day I got a question from um well from a colleague that was just looking into the code timing one and there was kind of a why did you implement this is a data class and then I can just send him a link to a whole section about about why it's quite useful yeah it's nice one of the things that I wanted to develop as we continue this podcast is to kind of get an idea of things that my guests are excited about that they're currently you know either packages or projects that were working with or even events or things that are happening in the Python world what are some things that you're currently excited about in the world of Python what one thing at least one a plug gets it's not nothing new at all but the I always use the ipython repple when I work with stuff just kind of it kind of I guess what's the start of the whole Jupiter project and things like this so it's very closely tied to that one but I find that it's definitely a huge improvement over their usual Python repple what are the things you like about it so yeah so if you kind of obvious things it kind of gives you much better of the tab-completion history and those kind of things when you're exploring stuff interactively all the output is saved in variables so you can kind of easily go back to your through your historical output in just get some data from it yes and when the help the help is easily available that you can just type anything and put on a question mark and you'll get the help text for it or if you do double question mark you get the implementation of the method that you're looking at so when you're kind of exploring different packages it's it's quite powerful yeah I use in my courses a Ruppel replacement that Dan suggested to me which is called be Python yeah and has a lot of similar functionality has a you know history and other stuff but you can just you know put a dot in when you're typing in the repple and it'll give you the methods or attributes or whatever and then also it will you know show a lot of the documentation as you're typing and yeah it's probably the most common question I get asked about my courses yes what is that exactly yeah we should probably just do a video of about the different ripples and yeah I think maybe you know like if they're I don't know there's like a article coming out soon but maybe I would just do a standalone video series that just shows like okay these are the different choices you have and how to implement them yeah because there are just you know beyond just the the straightforward thing and I agree that you know and sometimes when you're working inside of a to print or notebook having done a little bit of data science a previous job is that something I really miss is that interactivity of like okay well what can this thing do and not giving you some of that autocomplete and and so forth so right yes it's very nice essentially the repple that's kind of running the Jupiter so if you've done anything with Jupiter you'll feel right at home on inside of ipython and that the way I actually use it whenever I'm developing which I haven't seen too many other people do but it's kind of like using breakpoints and debuggers and so on but instead of adding a debugger I typically just say I want to implement the function and I just add in the DEF my function name parameters and then inside of there I import ipython and do ipython dot embed so what that does I started when it when you call that function it will start an eye part and ripple at that point in a program we told different variables defined so then I can interactively figure how to actually type my code and okay so find its really effective or are you inside an IDE then I usually just run everything from the terminal but if you're running inside the terminal in an ID then you it should work more or less the same okay and because then I can end up just implementing my my function interactively and then once I have everything there I PI can kind of has this special command started enough Python commands but it just helps you out in rekkles so one of them is history so then type history and I see all the stuff I've been doing and just copy paste that back into my code and then I have my function ready and then I can kind of iterate like that and yeah so handy yeah it's compared to how I used to do it with then tend to be that you kind of run stuff and print something here and there to debugger stuff like this it's so much easier just to drop yourself into Shaolin and then play with it or into Drupal the other thing I'm super excited about right now is I was trying to get the Raspberry Pi for when it yeah saw it came out in the summer and instantly it was sold out you know the idea of it has two different video outputs that can be in Drive you know two 4k monitors on this tiny little board it has four gigabytes of RAM now okay that's cool and drastically faster so you have to actually had like get like a fan and other stuff for it depending on the types of thing you're gonna use it for and so I've been I was doing a course on the Arduino and kind of got interested in the Raspberry Pi kind of related to that and I was helping out somebody through the comments and I and so I said alright let me just set this thing up and do a Python in it and so it was really neat it comes with thawne e is already in it and it has okay cool it has you know this raspbian OS that has both python 2 and 3 in it which is a little confusing I had to practice some Linux skills which I'm still working on you know the apps get and all those kinds of things of installing that you know making sure I have everything ready to go and and so I was able to sort of set it up and I said alright we'll go the next step with the IDE further Arduino on it and then I put in vias code and so I kind of got this little you know tiny computer that you know I can kind of just play around with and program on and I thought okay well how could I do like screen capture on it and I wanted to share this stuff and that's where it's gonna get a little more complex for me yeah so that's the thing I'm kind of kind of excited about right now and exploring the different uses it's just amazing you can have this whole operating system on time mmm micro SD card I want to give people an opportunity to kind of learn some of the things that you're working on I already mentioned that I'll include links to your your PyCon talk from 2019 yeah there's all the Articles that we were talking about on real Python yeah are there other things you want to plug or call out to ya now so I guess in addition to that I have a few pi PI packages that I mainly been working on for because I find them useful but so one one is the pipeline's that we mentioned already in connection to that I also have one called PI gulfs which is kind of for dealing with configuration files so they kind of played very nicely together with the way I kind of tend to structure things so the PI comes packaged it's essentially a wrapper around the different configuration format so it can read tamil files and any files and json files and Yama files and so on and kind of get them everything into into a common interface so that's one thing I've been playing a little bit with recently great ok you include links to that and the show notes yeah and it's still slightly unfinished but it's it's getting there so that's always fun yeah just going back to what you mentioned earlier I'm really looking forward to the Python conference and both getting to meet people there but also having a chance to run the decorators tutorial I think should be a lot of fun yeah it's several hours right yeah I think there's three hours lots more or less so you kind of have the days are splitting to so you have one morning session one afternoon session that's half a day I'm so looking forward to going and eating everybody and getting a chance to talk to all the people that are you like you said the people that visit site and yes and that that's one thing if we took a little bit more about Greece Python that's been really cool too less yeah I don't even know how long but half a year year or so it's the real Python community that's kind of I've been bills prep yeah if people want to join if you'd like to not only get access to all the 300 articles that are on or more that are on real Python but also you get access to gosh is like over 700 800 lessons now that are available as video there you get access to the slack right yeah it's a really neat community you get to join the arson you know this sort of the real Python members slack community and there you can ask coding questions introduce yourself and meet other people from all over the world that's one of the other amazing things about real Python is it's such a wide-ranging community we have yeah and yeah so I'm the community and especially the slack is to say I think it's it's a really nice place to hang out and just see all the stuff that people are doing there and we've had members that are kind of started out asking questions and then they go on to publish great packages on pi pi and things like this it's really fun to see see everything that people come up with and all the different things people are doing there is oh that's one thing I really enjoy as well yeah it's super positive to which you know sometimes you get up in the open web and are asking questions people are not always as kind oh right yeah no it's definitely it's a fun place to hang out alright well I want to thank you for for joining me on this initial episode here of the real Python podcast my pleasure it's been a lot of fun too to talk in hangout yeah I know that we can have much more further conversations about some of the other topics even the ones that we've worked on together like what what was new in Python 3 8 was right really great and another area that's sort of shrouded in mystery sometimes which is the whole area of type-checking yes in in Python so I think those would be great conversations to have further on down the road sounds fun alright well thanks again thank you I want to thank Karen for talking with me and I want to thank you for listening to the real Python podcast make sure that you subscribe to the podcast in your favorite podcast player and if you liked the show leave us a 5-star rating and a review you can find show notes with links to all the topics we spoke about inside your podcast player or at real Python comm slash podcast and while you're there you can leave us a question or a topic idea I've been your host Christopher Bailey and look forward to talking to you soon you
Original Description
Do you want to learn more about Python decorators? Have you ever wondered what goes on behind the scenes to create a Real Python article? In this first episode, We have Geir Arne Hjelle from the Real Python team on the show.
You’ll learn about Geir Arne’s background as a Pythonista and PyCon speaker, the tutorials he’s written for the site, how Python decorators can help you write better code, and what Real Python’s tutorial publishing process looks like behind the scenes.
Note: This episode was recorded earlier. We discuss PyCon US 2020 and his planned tutorial. At the time this episode was released PyCon US 2020 was currently looking at re-scheduling or a potential cancelation. Updates will be provided in upcoming episodes.
Topics:
00:00:00 – Introduction
00:01:39 – Geir Arne Python Background
00:04:16 – Real Python Background
00:05:55 – Real Python Editing Process
00:09:00 – Christopher’s Real Python Background
00:10:45 – Working on Decorators
00:13:00 – Decorators in the wild
00:16:30 – Pycon 2019 Talk - Plugins
00:19:32 – Pyplugs
00:20:09 – Links to talk materials
00:20:29 – Pycon 2020 Tutorial - Decorators
00:22:59 – Euro SciPy
00:23:47 – Real Python Meetup Pycon 2019
00:25:05 – More on the Decorators Article
00:26:18 – Slack Decorators Q&A
00:27:29 – More on Euro SciPy
00:28:12 – Current Position at Amesto NextBridge
00:32:09 – Decorators Examples
00:39:47 – What are You Excited About in Python
00:47:04 – PyCon 2020 Tutorial on Decorators additional
00:49:45 – Conclusion
👉Links from the show: https://realpython.com/podcasts/rpp/1/
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from Real Python · Real Python · 0 of 60
← Previous
Next →
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
A better Python REPL – bpython vs python interpreter
Real Python
Introducing large-type.com – A Utility Website
Real Python
Reading Hacker News Without Wasting Tons of Time
Real Python
Forward References and Python 3 Type Hints
Real Python
Using Sublime Text as your Git Editor
Real Python
Python Code Linting and Auto-Complete for Sublime Text
Real Python
Make your Python Code More Readable with Custom Exceptions
Real Python
Write Better Tests with Sublime Text's Split Layout Feature
Real Python
How to Use Sublime Text from the Command Line
Real Python
Rename Variables with Multiple Selection in Sublime Text
Real Python
Sublime Text Settings for Writing PEP 8 Python
Real Python
Write Cleaner Python with Sublime Text's Indent Guides
Real Python
Sublime Text Whitespace Settings for Python Development
Real Python
Function Argument Unpacking in Python
Real Python
Python Code Review: Debugging and Refactoring "Conway's Game of Life" + Automated Tests
Real Python
Using "get()" to Return a Default Value from a Python Dict
Real Python
A Python Shorthand for Swapping Two Variables
Real Python
Python Code Review: Refactoring a Web Scraper, PEP 8 Style Guide Compliance, requirements.txt
Real Python
Click & Jump to Test Failures from the Command Line (iTerm2)
Real Python
Setting up Sublime Text for Python Developers
Real Python
Sublime Text + Python Guide Overview
Real Python
Python Code Review: Adding Pytest Tests to an Existing Python Web Scraper
Real Python
Type-Checking Python Programs With Type Hints and mypy
Real Python
A Shorthand for Merging Dictionaries in Python 3.5+
Real Python
Python Code Review Flask Web Security Tutorial + Virtualenvs, requirements.txt
Real Python
My Python Code Looks Ugly and Confusing – Help!
Real Python
Setting Up a Programmer Portfolio/Developer Blog – How To Get Started
Real Python
Do I Need a GitHub/GitLab/Bitbucket Profile as a Developer?
Real Python
Programmer Portfolio – Example and Walkthrough
Real Python
How to Get Your 1st Speaking Gig at a Tech Conference
Real Python
How to Build Your Public Speaking Skills as a Developer
Real Python
The Object-oriented Version of "Spaghetti Code" is "Lasagna Code" ?!
Real Python
Setting up Sublime Text for Python Developers – Lesson #1
Real Python
Cool New Features in Python 3.6
Real Python
"is" vs "==" in Python – What's the Difference? (And When to Use Each)
Real Python
Emulating switch/case Statements in Python with Dictionaries
Real Python
Python Function Argument Unpacking Tutorial (* and ** Operators)
Real Python
What Code Should I Put On My GitHub/GitLab/BitBucket Profile?
Real Python
A Crazy Python Dictionary Expression ?!
Real Python
String Conversion in Python: When to Use __repr__ vs __str__
Real Python
Method Types in Python OOP: @classmethod, @staticmethod, and Instance Methods
Real Python
Optional Arguments in Python With *args and **kwargs
Real Python
Python Context Managers and the "with" Statement (__enter__ & __exit__)
Real Python
Installing Python Packages with pip and virtualenv / venv
Real Python
"For Each" Loops in Python with enumerate() and range()
Real Python
Python Code Review: LibreOffice Automation and the Python Standard Library
Real Python
Managing Python Dependencies With Pip and Virtual Environments – Lesson #1
Real Python
Python Tutorial: List Comprehensions Step-By-Step
Real Python
Leveraging Python's Implicit "return None" Statements
Real Python
What's the meaning of underscores (_ & __) in Python variable names?
Real Python
Python Data Structures: Sets, Frozensets, and Multisets (Bags)
Real Python
Writing automated tests for Python command-line apps and scripts
Real Python
How to find great Python packages on PyPI, the Python Package Repository
Real Python
Immutable vs Mutable Objects in Python
Real Python
PyPI vs Warehouse, the Next-Generation Python Package Repository
Real Python
pep8.org — The Prettiest Way to View the PEP 8 Python Style Guide
Real Python
My Experience at PyCon 2017 in Portland
Real Python
Pylint Tutorial – How to Write Clean Python
Real Python
"Reverse a List in Python" Tutorial: Three Methods & How-to Demos
Real Python
Python Refactoring: "while True" Infinite Loops & The "input" Function
Real Python
More on: LLM Foundations
View skill →Related AI Lessons
Chapters (21)
Introduction
1:39
Geir Arne Python Background
4:16
Real Python Background
5:55
Real Python Editing Process
9:00
Christopher’s Real Python Background
10:45
Working on Decorators
13:00
Decorators in the wild
16:30
Pycon 2019 Talk - Plugins
19:32
Pyplugs
20:09
Links to talk materials
20:29
Pycon 2020 Tutorial - Decorators
22:59
Euro SciPy
23:47
Real Python Meetup Pycon 2019
25:05
More on the Decorators Article
26:18
Slack Decorators Q&A
27:29
More on Euro SciPy
28:12
Current Position at Amesto NextBridge
32:09
Decorators Examples
39:47
What are You Excited About in Python
47:04
PyCon 2020 Tutorial on Decorators additional
49:45
Conclusion
🎓
Tutor Explanation
DeepCamp AI