Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set your subtitle preferences in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please refer to our video player troubleshooting guide for assistance.

July 29, 2020

Host David Amos discusses Real Python’s first roundtable article, a Django security article from Real Python’s own Anthony Shaw, and answers members’ questions.

In this meeting, we talked about:

  • Five favorite Real Python author packages
  • Cross-Site-Scripting attacks in Django and tools to prevent them
  • The @property decorator and how to use it
  • Resources for code challenges
  • The Python Basics Book
Download

Office Hours Chat 2020-07-29

1.5 KB

00:00 All right. Well, I hope everyone had a, had a good week

00:05 and, uh, let me turn off my notifications here. So I’m not blowing up with notifications.

00:18 Alright. So I got, um, a couple of emails from, I got one from Kenneth and, uh, from Andrew and, uh, they had some good questions that we can, we can talk about, uh, today, uh, to get started real quick.

00:31 I wanted to do kind of what I normally do, which is, uh, talk about the latest, uh, picadors issue. So, um, let me make sure I’ve got the chat open and everything, so don’t miss anything that’s going on here. Okay. Okay.

00:48 Okay.

00:53 Uh, so yesterday we released the latest pike coders, uh, number 431, and a couple of the cool things in that. Uh, we’ve, we’ve got a new, uh, it’s not so much a tutorial as it is a, we call it like a round table article, which is a new format that we’re experimenting with at, uh, at Real Python on Python packages. And, uh, that one was a fun, a fun one that, um, I did the technical review for it, um, and help them get this, uh, set up and enjoyed reading about it.

01:32 So it’s five of our authors that, uh, picked, uh, five packages that they like and wanted to share with everyone. So, uh, there’s some cool stuff in here. There’s the requests package, which, um, if you’ve done anything with, uh, interacting with the web and Python, you’ve probably used requests either directly or indirectly.

01:52 It’s one of the most popular packages, uh, PUD V for visual debugging, which, uh, I thought this one was, it was really cool. I’d never heard of PUD B. Uh, but if you’ve used PDB, uh, which is the command line debugger, uh, for Python, uh, [inaudible] is also a command line tool, but it gives you like a, a little bit more, it’s not really a graphical user interface.

02:16 It sort of looks like it is, but it’s, um, it’s, uh, I guess I call it like a textual user interface, but it’s all color coded and has some, some nice features. Uh, so if you’re working and a terminal, uh, and want a more visual debugging experience, then this is, uh, this is a really cool tool to do that with, um, the date util package, which is for working with dates and times it’s a lot more powerful than, uh, the builtin daytime package it’s got, uh, features for working with time zones and handling things like daylight savings time and all that kind of stuff. And, um, that’s, uh, definitely a very handy tool. In fact, there’s one example [inaudible] Well, this is, this is, uh, probably one of the most used functions from dakee till here, just the parser, where it allows you to pass a stream in almost any format you can think of, and it can infer the date from it. So, um, here you pass the string Monday, May 4th at 8:00 AM, and it gives you a date time object, uh, with it even says, okay, well, the closest one is in the year 2020, so it guesses the year 2020 for you.

03:34 And you’ve got maybe eight o’clock. Um, so this is, this is an incredibly handy tool, uh, rather than having to come up with a format string and all that kind of stuff.

03:45 If you’ve had to do that, working with, uh, with dates and times, uh, the typer command line interface, uh, I’ve not used this one before, but, uh, this is a way to create a command line interface, uh, automatically based on, uh, the typing system. Uh, so you can you have a script? So here’s a, this is an example of a very, very basic, um, command line tool that basically prints whatever argument you give to it.

04:17 So you, you run your command up PI file and here you have three arguments past two, one, two, and three, and it just prints those arguments. Um, and the same thing here, one, two, three, it’s just going to print a there’s arguments. So super basic, um, command line tool.

04:36 And then it talks about how you would go about doing the same thing, using something like Argh parse, which is, um, a tool in the standard library for making command line interfaces.

04:49 Uh, arch bars is great, but, uh, as the heading here says, it is a little bit clunky, um,

04:58 and typer allows you to do something very similar by creating, um, a function that uses type annotations on it’s, uh, arguments and type. It will automatically generate things like your help, um, the help display and parsing and validating the input and all that kind of stuff.

05:23 So it’s a really handy way to create online interfaces. Um, and I guess this would be Python 3.5 plus only because of the typing system there, but anyways, it’s a neat, neat article, um, wanting to share that with you guys. And, uh, so you see those, those cool tools that, that, uh, people are using, uh, and yeah, check it out.

05:49 Um, read it. I think you guys will, you guys will enjoy it. It’s a, it’s a new format and I thought it was kind of fun. Um, and we might do more things like that in the future.

05:58 Uh, just to give you kind of a round table of, uh, different, different things that all of us authors, uh, like

06:07 does anyone have any experience with any of these packages or are so parser? Yeah, No, I’m creating it myself. Somebody else’s Oh, there was one package I missed actually, uh, the purse, the purse parts package. Yeah, this one’s super cool. Uh, so if you’ve done any, any work with, uh, regular expressions, uh, this is, uh, a lot easier to work with than trying to build your own regular expressions. Um, Well I found it awesome. What’s that?

06:55 Um, I started using it actually today. I I’m using his breath now. Oh, fantastic. Cool. And you’re enjoying it. Yes, yes. Actually I did enjoy this round table kind of article.

07:09 I think it’s a nice four months too, to have some sneak peek into a lot of different authors thinking about some, some, some topic or something like that. I think it goes really nice.

07:20 Yeah. Yeah. Good. Thanks. That’s that’s good feedback. Um, and I just saw Kevin in the chat said, ah, come on, regular expressions are great. Talking about the, uh, the pars, uh, yeah, regular expressions are great and, uh, parsley uses regular expressions on the backend. It’s, it’s creating all the regular expressions for you. Um, but it’s got a really nice interface, which I think most people would agree is better than standard, regular expression, uh, syntax. But, um, I don’t know.

07:54 I just, I spent, it seems like dozens, if not a hundred hours in a college working on regular expression problems and,

08:06 uh, trying to figure all that stuff out. Um, but yeah, Parsons parts is a great way. Um, if you’ve got data and you need to parse that data, um, and you’re willing to add a third party dependency in there, then it’s a, it’s really cool. So this is a, I need example where you’ve got, um, like this, this kind of format type string where you’re saying, okay, there’s going to be something coming with author.

08:29 And then I want to get the name and the email. And, um, you can, Oh, he’s sending it here. Uh, this pep four, nine, eight is a doc like a string that contains the whole text of pep four 98.

08:47 Um, and, uh, the result of this parse is it grabs the name, Eric B. Smith and email, Uh, for you out of that. And then you can use a dictionary style, a subscript to, to look up the name and you have access to your spans, like you would on a normal match object, uh, and, and all that kind of stuff.

09:09 So, uh, pretty cool.

09:14 Let’s see, there were a couple of other interesting articles. Um, Oh, this was, uh, an interesting deal. I’m not sure if you guys saw that they, they released Python 3.8 0.5, uh, very quickly, um, as, uh, there was some security, hot fixes, uh, in there. So if, if any of y’all are using Python 3.8 0.0, up to 3.8 0.4 in production, you probably want to upgrade to 3.8 0.5 to, uh, deal with.

09:48 I’m not exactly sure what the security issue was, but, um, but they released it. I mean, there, I had just updated the 3.8 0.4, uh, less than two weeks ago. And then now they’re pushing out three point 20.5.

10:03 So they did that really quickly. Um, this is an article from our own Anthony Shaw. Uh, this is not on Real Python, this is on his personal, uh, personal blog, but, uh, he’s been exploring, um, Django applications and security issues with them.

10:19 And so he’s written this article on Christ’s cross site, scripting exploitation, um, in, in Django applications. And so if you’ve got a Django application that you’re working on or, or, uh, responsible for maintaining, then this might be a good read just to see, uh, what some potential issues are and how you can, how you can deal with them.

10:42 And what he’s come up with is, um, there’s a tool at the end.

10:53 Uh, he’s come up with this Jingo, exit X S S fuzzer, uh, tool that he’s created, uh, that,

11:02 uh, creates, uh, there’s some middleware that gets put in here that just can help you test whether or not, uh, your, your application is, um, you know, robust and can handle some of these, these kinds of attacks. So there’s that you guys might want to check out XSS exploitation in Jengo applications by Anthony Shaw.

11:34 All right. So I guess the next thing I’ve got, we had, like I said, I had a couple of emails, one from Kenneth and one from Andrew, and Kenneth, yours was the one about the property, correct? Yes, using properties. Yeah. So, do you want to ask your question here so everyone can hear it, and we can talk about it? I sent you the attachment that goes along with it. Yes.

12:04 What I was trying to do is apply the @property decorator to that program.

12:13 It’s a very simple program, but it was something that I—

12:20 and that’s why I wanted to be able to do it, but I just can’t figure out how. I mean, all the instructions I went through just didn’t sink in this hard-boiled head.

12:37 Okay. Gotcha. So what Kenneth is talking about is the @property decorator when you’re creating a class, and how you use that. So, Kenneth, do you mind if I share your code?

12:59 Okay, that’s fine. Yeah. Just remember, everybody, I’m just a newbie, sort of a newbie, about a year under my belt, but you know, it’s still—I’m having fun, but I’m having still a lot of difficulties.

13:13 Let me

13:17 get set up here and copy and paste your code, and then we’ll open it up. You know, I had to send it as a text file because it wouldn’t accept it as a Python.

13:35 Oh yeah. I know some mail, probably most of them actually, won’t let you send script files, so you can’t attach like JavaScript or Python files and things like that. So yeah, text is a good way.

13:50 All right. Let me find my share-screen controls here. Where did they go?

14:07 Okay. So what Kenneth trying to do here is create a Circle class that

14:22 takes, when you—to initialize it, you pass the circumference, is that correct? Correct. Yes. You pass the circumference of the circle, and then it will calculate things like the radius, the area, the diameter. And then you’ve got a nice .__repr__() here for it to display what you’ve got.

14:44 And I forgot to copy a couple things there, but I guess the question you’re asking is how would you go about using the @property decorator to, say, have like a .radius property that when you change the radius, then all the other properties and attributes change to reflect that. Is that correct? Yes.

15:04 Yeah. So I guess—

15:12 I did get a lot of recursion errors when I was trying to do it. So let me, I think you said you’ve seen a lot of, sort of like the basic examples, and they weren’t kind of clicking for you.

15:30 Yeah, I went through… I’m not sure what examples you actually saw. I went through everything on Real Python, as well as Corey Schafer’s videos and a few other videos

15:46 where they give, basically everyone gave all the same examples. Okay. So there was nothing in there that was ample to help me connect the dots. Okay. I think if you’re getting recursion errors, it’s because you have a self.radius attribute, and then you’re trying to set it at the same time as a property, that might be problematic. So if you refer to it to self.r, you might get around those problems. That’s just me guessing.

16:20 Okay. And then that’s a, that’s an idea. Cause I was thinking that too, that I just wasn’t. Uh, and then I was thinking, because I wasn’t, I didn’t set it anything to private. It was all public. Yeah.

16:31 So that’s another thing I was thinking of, but it’s like, I would get pieces of the, of the puzzle, but I didn’t lead me any to any other conclusions. So that’s why I’m seeking help.

16:47 Yeah. Let me, um, yeah, your classes called circle. Let me go through a really, um, like basic, uh, example and, uh, and then we’ll adapt it to two years. So I’m just going to do what I’m going to do is actually,

17:09 uh, do the radius as the input and I’m going to call it self dot underscore R.

17:18 Okay. And, um, and then I’m going to have a, excuse me, I’m going to have a property called a circumference. I’m just gonna call it circum. Well, I’m going to have a first, it’s just gonna be a method that calculates the, uh, the circumference of the circle.

17:45 So it’s going to return,

17:50 Let me see, uh,

17:57 testing my, uh, knowledge of, uh, I majored in math. So I should, I shouldn’t have it twice. Uh, PI times the radius gives you, uh, the circumference formal up there anyway. Yeah.

18:11 So, uh, this will write if I create a class, then I should, uh, pass in the radius and then I’ll get the, uh, circumference with this. So, uh, to turn this into, um, maybe we should check that it’s, uh, that it works on the score. It should. Yes. Thank you.

18:31 And it should be a hundred score Aria. Thank you. Um, so to turn it into a property, you just use this property decorator and now, uh, what I can do is if I,

18:54 if I run this in interactive mode, I have a syntax error somewhere.

19:04 Uh, do I see it? Let’s see.

19:16 I don’t see what the syntax errors

19:28 let’s see. Let’s, uh, you know, just comment all that out.

19:38 Uh, so I should be able to create a new circle. Let’s call it low lowercase C uh, with a radius of one. And

19:50 I get the circumference, uh, by typing rather than having to call it as a method. Uh, I can just, uh, call it as if it were like a, like an attribute, right?

20:01 So did you get that far, at least in, in all this?

20:07 So the question then becomes like, if I try to set this, say, I want my circumference to be 10. Well, what actually happened here?

20:24 I’ve overridden that method completely. Now it’s just a, a, just an integer, but my, my radius didn’t didn’t change at all to reflect anything. It’s just, I’ve just destroyed the, the method on the, on the class.

20:42 I’ve replaced it with just the integer, uh, nothing’s happened so you can use, um, this, it almost looks like you’re got a decorator now from the method name and you do dot setter.

21:01 So this is, uh, using it to like, what happens when you set this to a value and you use the same name for the method, and I’m going to call this a C then what this should do is it needs to calculate

21:21 the new radius for us. Right, right. When we set it to say 10, I want it to calculate the new, the new radius. So, uh, you’ve actually got the formula right up here

21:37 instead of self dot radius itself dot underscore R And that’s part by mistake. But then I tried both ways. I tried making it private and I still kept on getting problems. So I just probably was doing something else wrong or, Well, I think that a Bart was probably right with the recursion areas you were saying.

21:58 So if you got this far and we’re doing something like, like this and recursion area errors, it was probably because, And that’s where it was showing up a lot was also, uh, in the repre. It would be a saying that I needed to wear a hat because I had this self doubt radius instead of the self Duff underscore radius. That’s what I should have been doing. Okay.

22:26 I believe so, because now if I, if I set the circumference to 10, uh, and then I look at my radius, it still hasn’t,

22:40 hasn’t changed. Did I save the file? I did say At least you’re getting something out and I wasn’t getting anything out. I was just getting errors.

23:21 Did I spell it wrong?

23:26 Hmm. Well now I’m, I’m

23:31 stumped here. What am I doing wrong?

23:48 Oh, man. Um, the, uh, no, no, I’m sorry. No, I’m just thinking something else. Sorry. Nope, no problem.

24:00 Does anyone know what, uh, what I’ve done wrong here? Why it’s

24:08 setter? Uh, and, uh, I just saw Wade was asking what the, in your, uh, referee here was asking what the, um, exclamation point are, uh, is here that, uh, forces that’s a formatting specifier that forces the F strength, display this using whatever the wrapper of that object is. Um, normally if you don’t include that they would use the string representation.

24:38 So these are just numbers. It probably doesn’t make any, any difference, but if this were like a, like an object, um, and you wanted to print out what the repor was instead of the string representation, you would use the X explanation point R uh, to force it, to do that. So that’s, what’s going on. And there’s a couple of other ones.

24:57 That’s the only one I’ve seen used. There’s like an a and an S but I’m not sure what the differences are. Um, yeah, that’s a good question. Uh, I, the only one I’ve really used is the VR I’ve used before, too. Yeah. Um, but let’s see if we can figure out what is going on with, uh,

25:33 anyone have any ideas.

25:37 I wish I knew I’m looking at it as well.

25:42 Um, Hey, I just joined, sorry for being late. So, uh, what, what’s the problem exactly is that Taj speaking. Yep. Good morning. Uh, we are, uh, looking at how to use the property decorator on a class.

25:58 So this is a class representing a circle, uh, where you pass to it, some, some radius, uh, and it’s got a circumference property that returns the circumference of the circle, and then a setter that when you, you set the circumference to some value, it should then update the radius on the, on the circle. Uh, however, wouldn’t be the problem when we run it. Um, so down here, I believe I’m still sharing my screen down here. You can see that, uh, I create a radius of circle of radius one. Uh, I get the circumference of 6.28. Then if I set this a conference to 10, the, uh, radius has not updated at all. It’s still one interface.

26:42 Python it’s Python Oh my goodness. I was pretending like I’m thank you very much. That’s exactly what happened. I was running it in Python too. I’m so used to having a, uh, a virtual environment automatically created for me.

27:00 That’s when I set this up quickly, I forgot to do anything as a windows guy. I would never think of that. I think Python to the division has a different behaviors, so that goes lash over it there, but it’s true.

27:16 Isn’t it?

27:19 Uh, correct. Yeah. Uh, uh, So I was wondering, should we put up pair rate? Is this mine three C divided by,

27:35 and that expression between parenthesis are my metrics or my math skills are lacking and women know I get, put it in Perth.

27:48 Yeah. Python practices. And then go divided that answer will go divided into the two. And that’s probably, yeah. Okay. Okay. Did I do that correctly? We got this at conference and we want a radius that equals C so I, but yet two times minutes. Yeah. Thank you very much.

28:12 Cause you’re right. Because the order operations, it was doing C divided by two, calculating that, and then at times mapped up pie. Yeah. So we had that issue as well as running it in Python two.

28:25 So now if we do a circle of radius one and

28:33 mr. Conference, and then we set the circumference to 10 and we should see an updated radius there of, uh, 15 point 0.7. I don’t, I don’t get it because of the screen cuts it off. Oh, does it really?

28:47 Yeah. Yeah. Same here. I think if you move your mouse and click over, at least in my computer, it, it, it, it hides the zoo bar in the end. I see everything.

29:05 Yeah. Can we see it? Can everyone see it all now? Yeah. Okay. Maybe this is a better way to do it here. Um, okay, great. So, uh, we learned it, make sure we run the correct Python version and Correct Python version.

29:22 Yes. Yeah, yeah. That was just me in my haste. I, I just, uh, normally when I set up an environment it’s all taken care of. And then I, um, I do everything just by running Python, uh, there, but I did this very quickly on the spot, so, um, okay. So in, in your, Uh, my example that I had given, Yeah. So in your example, let me, uh, my goodness,

29:56 let me comment to all this and commented.

30:03 So you’re starting with a little bit different here, starting with the circumference, I’m setting it. So you don’t put it, it will automatically be sent to one,

30:18 Right? Yeah. You’ve got the default value of one. Um, so I should be doing That should be self dot underscore, If you want to be able to like set it as like a property later. Yeah.

30:32 Yeah. But I’ll need to, that one can stay that one, but everything else is going to have what have to be changed. Yeah. Um, a couple of things, let’s just, so you’re first checking to see if C is negative and then you’re raising an exception. Uh, so that’s, that’s good. Uh, one thing you could do is before you assign anything, you could just check it straight away, uh, and raise that exception and then do all of your assignments down here, just a slight modification. Um,

31:09 uh, another thing is, uh, you could, instead of using exception, uh, you could do a value error, which is a little bit more descriptive of what kind of problem that is.

31:21 Uh, so, um, when, if you try to pass a negative circumference, then this will actually, instead of just saying exception, it’ll say value error, because it is an error in the value. It shouldn’t be, it shouldn’t be negative. It should be, uh, it should be positive. Um, but, uh, let’s move on to, uh, well we want a underscore radius and then this needs to be well. Okay.

31:48 And that doesn’t have to be easy. Yeah. We can still use it. Um, and then you’re, I see, just to make it a little bit easier here, um, our times are, so this is correct diameter, so let’s do Yeah.

32:06 But the R equals self doc radius should be our Eagle self dot underscore radius. Oh yeah. Correct. Yeah. And then in your repor.

32:19 Yeah. And that’s where that’s kind of stuff. Thank here’s. That’s going to have to change the own radius too. Yeah. And here actually Be careful in what you’re doing here is, uh, actually updating the value of, um, updating the depth of the radius.

32:39 And I believe turning this into a string

32:47 formatting

32:52 instead of the string room that’s most. Yeah. But you’re updating those values there. I think it’s a better practice to just store the radius and nothing else, and then calculate all the properties.

33:08 So that way you only have to change the radius and nothing else. And then when you’re doing the representation here, um, you can just refer to for radius because at that point it will pick up the property and then formatted with two decimals. Yeah. Um, so you could do something like just do our, the, an a here and then do those here as well to those individuals. Yup. Yup.

33:39 And then that way you’re not actually changing the, uh, oops, that way you’re not actually changing the values of those attributes on the class itself or on the instance. Um, another way that you can do it is to use the format specifier inside of the F string, uh, inside of the curly braces here. Uh, so the way you would do that is, um, if you’ve seen the, uh, this syntax before then you could, uh, this would be something like self dot radius like that, and that would just format it inside of that string for you. Um, I’m going to put it back to the way we had it before, just so it’s not a, we’re getting a little bit outside of our, our discussion, but that’s, um, that’s another convention you can use. So if you’ve done, like you may have seen that in, uh, like the format, uh, method on strings. Um, you can use these formatting specifiers, uh, to round and all sorts, all sorts of different stuff. You can pad, uh, values so that they have like spacing and everything, but you can use those in F strings as well. Uh, but this is also a valid way to do it. So, um, so now we can go and create our property.

35:00 Let’s do a radius property,

35:11 I’ll add the property to creator.

35:17 Uh, so the radius, then we are going to just return the value for the radius.

35:27 And then,

35:38 Uh, when we want to set it, and then we need to update their circumference. Um,

35:47 so that would be underscore C and then we want to update, uh, the area.

36:00 Uh, well, we also first we’d update the actual radius here

36:12 in the chat, but you have a typo when you’re referring the wrapper to self radius, it should start with an underscore.

36:23 Uh, that’s a line 17. Oh, I see it. Yeah. Yeah. Correct. Cause we changed those before. Uh, and then let’s see area

36:38 here. I’ll just copy all of this.

36:52 So then that should update everything for us.

37:04 So I’m going to call it with just a circumference of, of one. So I should be able to see that what is our circumference? Just underscore C right? Yeah. We’ve got this, a conference of one and we can look at our radius. Actually.

37:19 I can just use the radius property since we created that. And then if I change the radius, say to two, okay. We didn’t get the recursion error and we see the updated circumference and

37:37 area

37:40 area is exclusive conference. So it was a combination, a couple of things I was doing wrong. I was getting some of it. Right. Yes.

37:51 Yeah. So I think the key is, is using the different, a different variable name for the property as an attribute on the private making sure it’s private. Yeah. So this is when you use this underscore, it’s not really private. Um, you can’t actually do a double underscore, which does make it quote unquote private, um, in, in Python, it’s, it’s not seen very often. Um, but this might be kind of more in line with like the, um, what we’re doing here. So this, you wouldn’t be able to just change it by doing like C dot underscore underscore C equals whatever you think it has to be private.

38:36 It’s just signaling to whoever’s using the class that they shouldn’t be touching those attributes in the first. Yeah. Basically. That’s how I see it too. Yeah.

38:45 This is a much more conventional, just, um, have the single, single underscore. Uh, but, um, but the double underscore does exist and that does actually make it, uh, more of like what you would traditionally think of as a private, uh, attribute on the class. It’s just not used very often. Um, it’s not really the quote unquote Python way of generally doing, doing those things. So, um, I think it’s worth noting.

39:14 That’s using double underscore, uh, is actually useful in terms of, uh, some classes. So if you have like, uh, if you want to sub class or extends to other classes that have the same name of a field, then you actually need to use double underscores, which mango the names to avoid collisions. So that’s, that’s the mechanism.

39:38 That’s true. Yeah. Yeah. And we might be getting too, too deep into that. Just a candidate. You probably don’t need to worry about all that, uh, right now, but, um, but this would be how you would set up the property. Uh, action. You know, it’s funny because I tried doing it, but I think when I did, I messed up down the line as I was trying to get everything set up still now I see exactly what I did wrong. All right, great. Yeah. Good.

40:10 So David, one thing I learned from this is if you want to make a read only property, then it doesn’t just work by providing the property decorator. You should also put in the set property decorator for a set property procedure, and then basically ignore it or raise an error because if you don’t do it, then does your property simply get overridden?

40:39 Uh, yeah, if you don’t have like a setter that would do something different than, yeah. We saw that before, right. Where, um, when I didn’t have the setter and I tried to set it to something, then it, then that name on the class just got assigned to whatever I assigned to it.

40:55 It was no longer the method was gone. We lost that property method and it just became the value that I, that I assigned to it. Um, if you want to have a read only, uh, property, um, what you just described would be one way, one way to do it. Um,

41:15 I, it’s one of those things though, you know, in, in Python you generally try to avoid that, that kind of stuff. Um, it’s really, it’s a, it’s a totally different philosophy from, uh, something like C or Java or, you know, where there’s this idea of, of keeping things private versus public and, and who should have access and everything. So, uh, which is why there’s not really this like built in, uh, support, I guess there, I mean, there is built in support, but it’s, it’s not, it’s kind of tucked away and it’s, it’s hidden, um, uh, from you. Um, it’s just, it’s not a, you would want to think very, I guess, carefully about when the right situation to do something like that. Uh, that is

42:05 pretty,

42:11 Uh, sorry, I missed, I missed that. It was kind of cutting in and out. If you wanted read only, you’re probably better off just making it a function,

42:21 Correct? Yeah. That would be, yeah, exactly. That just returns something. Well, I mean, it’s still, if, if, uh, if you still, if you assign something to it, you’re still gonna over overwrite it. I mean, it’s just the way Python, uh, Python work. So I believe let’s see.

42:40 It’s actually a good, a good question,

42:47 But you’re just signaling something different to the user of the class, if it’s a function. Yeah. I wouldn’t be overriding that so quickly. And I heard someone else say, say something, did someone else ask a question or Yeah. From my understanding, just to know

43:06 what you’re saying,

43:09 was it because you wanted to control the circumference and the diameter, you would’ve stopped with the property method, if you wanted to control or assign the value to the radius, if you wanted to change the value to the property and stop there, but since you wanted to control the circumference and the diameter, is that right?

43:27 Exactly. Yeah. Yeah. Um, well actually, no, uh, that’s not exactly right. Um, so even if I wanted to change the radius, uh, so here, let me, um, so I’ve got, I think I still got my old class here is C. So I’ve got, um, it’s create a new circle, uh, with radius one and

43:53 Oh yeah. Circumference. Um, so

44:01 Actually I think I need to,

44:07 Um, rerun this. So I’m getting rid of the setter here and just, I’ve got the property and create a circle of radius one and I’ve got my, I can get my circumference from that. If I, if I set the circumference, say to 10, then, uh, I’m going to get the, add this attribute error, can’t set, uh, the attributes.

44:40 So I need that setter in order to be able to update the, uh, there’s a conferences as well. So it does go both ways. It’s not just cause I was trying to update, uh, the other things it was, uh, and, and really it’s because there is no, there isn’t really an attribute called circum. I mean, it’s, it’s, it’s a method that’s being wrapped with this property, uh, decorator.

45:10 So sort of the normal rules of attributes don’t quite apply in that situation.

45:22 Good. Alright. Um, and while we still got some time, there was, I get an email from Andrews. I want to make sure I address your question as well. Can it three, are you good?

45:37 I’m good. Okay, great. Now I realize I was close, but no, But it’s still, yeah. Okay. Um, well I’m glad, I’m glad we were able to help you there. So, uh, let us know how it goes when you’re, when you’re working on more stuff there.

45:54 Um, Andrew, uh, had a question, let me pull up his email. So I make sure I get everything that

46:02 you wanted to talk about. Um, so Background on that or just, just want to call it out. Um, yeah, I mean, I guess if you want to, if you want to ask it so everyone can hear and provide, I think coming in cold might just seem a bit stupid.

46:19 So it’s kind of a newbie and I guess my background is finance and accounting and investment banks. That kind of, I was trying to come to an end now for different reasons.

46:30 And so really kind of doing this a little bit for fun, I guess, but also as, as something I’m very interested in. So while the deep learning kind of, um, AI kind of, um, work, um, online courses and stuff I’ve been interested in and I’ve been a programmer, I’ve done a lot of CQL and, um, some XML, but I never considered myself really a program it’s was just more like getting, you know, using stuff to get extract data that I wanted.

46:54 But I want to sort of say that forward now, now actually what I realized in some of the courses I’ve been trying to do is that it’s my Python, that’s letting me down.

47:01 And when I went through a big thing of, do I choose bar or pipe,

47:07 or does the heavy lifting, et cetera, actually, I’m going down the road of no, I’m going to concentrate on Python the can’t be doing too many things, basically just using, going, haven’t gone down that sort of room.

47:18 It’s kinda like, um, uh, done some different courses and things on my sort of intro. Um, I’m getting things, but I still find that I’m getting confused really in terms of how do I build that? How do I get going in that? So I know you have some sort of Python, you know, starting tutorials and stuff is like, is the best way to actually just start working through those and set myself maybe a couple of weeks plans rather than too far in the future and see how it goes and posts thing, or is it more like, is it a question of speaker specific kind of, I don’t know, project, if you like to work towards, and then, you know, it’s a chicken and egg sort of situation. So just to get that confidence, I guess, going just in the time, which The language itself with Python. Yeah. Um, so I, I would say that, uh, do you have, uh, are you coming from a programming background already?

48:14 You know, as I said, I’ve played around with some of that SQL XML for awhile, but, um, yeah, it’s, um, a more sort of, uh, I figure I can get the data on what is needed, but I’m gonna really want to sort of, I guess, do a deep dive and really, really get to learn Python in order to actually go forward with things like deep learning, et cetera, and machine learning.

48:39 Gotcha. So you want to start from the basics. So I would say, you know, we’ve got, um, on the website, these learning paths, and I think this would be a really good place for you to start. Um, and there’s a, one of these is an introduction to Python learning path. Right.

48:59 Have you seen this at all? Yeah. Okay. Um, I think, you know, working through, excuse me, working through some of this is going to be a good way to learn some of the basics of the language and get some of, uh, some experience with that.

49:15 Uh, there’s quizzes with each of these, that, which is a really good tool to, you know, check that you’re actually, um, you know, retaining and comprehending the information and everything. Uh, so I highly suggest using those.

49:29 And is that pretty much sequential? Is it so it’s okay. Sequential. Yeah. So you can just go through this, uh, and everything it’s um, I, I think the big feature that’s going to help you with is it’s just having those interactive quizzes is probably the big thing just for you to kind of go back and test that you’re actually retaining that knowledge and everything.

49:49 Uh, definitely recommend that. Um, I would also recommend looking into not only because I, I did write this book, but, um, uh, but I also believe that it it’s, um, it’s a really good tool for learning, learning Python and if my internet works here we go. Uh, uh, we have this, uh, book, uh, Python basics, practical introduction to Python three. So this is, um, kind of a little bit of a different approach from the learning path. Uh, the learning path is more, uh, just showing you, you know, this is what you can do. Uh, here’s the syntax and here’s how it works.

50:25 Um, yeah, the Python basics book is a much more practical kind of hands on introduction to it. So it gets you quickly into actually doing little projects and things like that.

50:36 It’s gotten exercises in each chapter and we’ve also got a, um, uh, there’s a, uh, corresponding, uh, GitHub repository that has all the solutions for all the exercises. Uh, so you can go in and see all of that. And, uh, there’s also there’s challenges in the book. So, uh, and the solutions to those challenges that there too.

51:01 So like exercises are sort of like the little, like almost regurgitating the information you just saw, just kind of like, can you kind of spit it back out and can you see it?

51:10 The challenge actually takes it a step further to, um, challenge you to build something on your own. Uh, and then each chapter has its own interactive quiz that you can, uh, use to check your understanding with that too.

51:21 So that’s another good one. Uh, and once you’ve moved beyond those, I would say the learning paths are a really good place to start then expanding beyond all that stuff. So we’ve got learning paths for, uh, web development, for data collection and storage, data science, dev ops. I mean, all this stuff you can, you can think of, and we’re continually updating these and adding new learning paths, adding new things to the learning paths, right?

51:49 So there’s a lot of resources there for you to get going once you’ve, once you’ve learned the basics, then to even explore Where do you target? What are your interests?

51:58 Yeah. And I know that in your email, you had mentioned like some, uh, like question, you had a question about like the kinds of math and statistics and things like that, that you might be, uh, so we’ve got, um, and the data science, I think it’s in this, um, in this, let’s see, we’ve got,

52:17 yeah. Python statistics, fundamentals, how to describe your data. So that’ll, uh, not only introduce you to working with statistics and Python, but it does actually describe some of the statistics and things like that. Um, uh, things like correlation. Um, and then we’ve also got, uh, on Real Python, we’ve got to linear regression article, uh, linear regression and Python, uh, uh, logistic regression and Python, uh, so we’ve got quite a bit of resources even on the, on the math end, uh, for doing Okay. Great. Because I mean, as I said, I’m quite happy to dive down the maths thing is over my best subject for good or for bad. Um, but it’s kind of one of those things. It’s a rabbit hole situation, isn’t it, to me, it’s a logistic regression. And how far do you go?

53:04 And what I don’t want to do is get down to Portland. All I’m doing is running libraries. I’ve got no idea what the massive doing, but at the other hand right now, I think I need to concentrate on getting my Python up to speed into the maths as, and when it’s necessary. Would that be, Yeah, I would, I would recommend getting, uh, just the basics of, of Python down.

53:24 You don’t need to get into nitty gritty on the advanced Python topics, but you need, you need to be comfortable with the syntax. You probably need a little bit of an introduction to like classes and object oriented programming and things like that. But, um, but, uh, you don’t need to be a master of, of all the crazy, you know, the whole standard library or the iterator protocol or all this kind of stuff.

53:50 I think, I think I’ll always be, you know, if I have a task to do or something, but what do I answer

53:59 the questions then come out and you can reach out to people with a little bit more knowledge to go well from a very good way to do efficient, or you can’t scale it, but I need to start kind of running from the beginning.

54:10 I’m quite happy to do that. I don’t want to just dive into something. I just can’t understand. So it’s about building up, you know, within reason, good foundation and I guess ones like this to be able to then ask any questions, you know, as, and when they come up.

54:23 Yeah, absolutely. Feel free to ask here in office hours on the Slack Slack community, we’ve got a coding questions channel on Slack that you can ask coding questions and get help. Um, and if you email me, um, I’ll, you know, I’ll be happy to talk about it during office hours as well.

54:39 Okay. That’s great. Yeah, because online courses get you so far, but then I think I missed that kind of interactive of, you know, talk to me like shit Real person to actually say, well, actually, what am I doing wrong? It could be something quite simple. It’s like, Oh, actually you don’t want to be looking at that. That’s the wrong way to go. Or, you know, you missed it and underscore, all right, got it.

54:58 Then going out and playing with it. So told me to need to be told what to do necessarily, but it has kind of like strips those triggers basically to actually say, am I going in the right direction here? Or am I just completely caught off, off point? So that’d be quite useful. So yeah, I think diving into that in more detail. So that’s, that’s a good way to go.

55:20 Johnson’s landing bounce and the book as well and worked through that. So thanks very much. Yeah, no problem. And, uh, Philippe posted in the chat, uh, an additional link, uh, on doing data, price, data processing with pandas. So, um, something else you might want to check out once you’re, once you’re there. Um, and, uh, yeah, parts posting about code Wars, uh, and, uh, some other, uh, some other resources there to get practice with Python. Yep.

55:54 There’s lots out there. Thanks a lot guys.

56:00 All right. Um, we’ve got just a couple of minutes left and, uh, before we close out, um, I wanted to give Ricky the chance to, to talk about, uh, something he’s been working on Ricky. Is that right?

56:13 You wanted to talk about this, right? Uh, yeah, I’ll try and make it quick. Maybe we can talk about it more next week. I can go over a little bit if we need to. It’s fine. Um, so, Uh, for those that don’t know me, I’m, uh, the, um, community manager at Real Python and, um, so I’m in charge of not only all the social media, um, and responding to all the questions and answers I get, but also kind of helping people in Slack where I can, um, my coding background is that I’m self taught and I’m kind of a low end intermediate developer. So I’m not always able to help, but one, one thing that I’ve noticed in the community Slack is, um, we have a lot of people that might never have used Slack before.

56:57 And sometimes it’s hard to help people when I don’t want to say doing it wrong because it’s, there’s no right way of doing it, but there are better ways to ask for help.

57:09 And there are good ways that you can show your code in order to get help. Um, so what I’m, what I’m working on is a kind of like guide to Slack for people who sign up for membership, we have a Slack bot that, um, kind of welcomed you and the idea will be that it gives you that resource at the moment you sign up, but we will obviously send it out to everyone, um, when it’s ready. Um, so the idea is that I’m going to write it to, to not only kind of, um, for those that are new to programming is, um, kind of inform them how to ask a question has to ask a good question.

57:49 Um, but also little tips and tricks about how to actually use Slack itself. Um, so I mean, that’s the, the kind of the angle I’m coming at it just to kind of make it a little easier to pass when you’re scrolling through Slack, essentially, um, which benefits everybody, right? And if it’s not, I don’t want to be like, uh, have a hard and fast. This is how you must do things. Um, you know, it’s not necessarily a style guide, but it’s, it’s kind of a, maybe you can consider doing it this way because it will help you get better answers. Um, so what I wanted to do is basically ask you if there’s anything, I, I’ve got a good idea what this thing’s going to look like, but I did want to get some feedback as to kind of, what are the things about Slack that you’re not sure about how to do, or what are the things that confuse you or irritate you, or, uh, you know, bug you in any way and kind of, if I’ve not already planned to cover it, then maybe I can add that in

58:50 Is the key to submit rather than like a line break,

58:57 the text that you’re writing. So the number of times of written

59:09 I’ll add that, but yeah, there’s literally a toggle. Um, so you can, you can set it so you can press just enter or put down the line and then if you shift into it will then submit. Yeah, I cannot do that. Can I share my screen? David

59:29 you’re muted. David, you want me to, uh, yes. I, I have permission. Yeah. I’m not disabled. It’s disabled. Yeah. Um, Hm, let me see. Okay. You should be able to do it now. Cool. Uh, alright.

59:51 Can everyone see my, uh, glorious theme? Yup. It’s not you, it doesn’t usually look this bad. It’s just the, uh, the light theme is better for screenshots. So, which is what I was doing earlier. So one thing I see people are not aware of, and it’s something I’m gonna, um, do in depth, uh, in the, in the document or, or whatever it turns out to be.

60:14 It may end up being an article. I’m not sure yet is you see kind of this code a lot where people would just copy and paste into a code block. And while it’s okay, often the formatting can be off or, you know, it’s kind of hard to read.

60:29 A lot of people don’t realize that these code snippets exist, where I can, especially if I’m, I’m sharing a lot of code. If it’s a small amount of code, this is probably fine, but you’ll see in Slack, people are sharing, you know, 50, a hundred lines of code. Um, and this system attacks it. It’s so nice. The formatted, um, let me just move my, uh,

60:56 it gives you alluded in the code snippet, so, Oh, and he’s trying to help you. I can literally just click this to download it and then open up, open up the code snippet.

61:09 You’ve just sent me and it’s going to open up in my code editor, which you probably can’t see right now. Cause I’m not sharing that part on my screen. But, um, so my code editor just opened up with that code. Um, so I, I, I think this is a feature that most people don’t know and will be prominent in the, in the guide. And if you’re curious and you don’t know how to do this, if you click this little short cookie key here and go to create a code or text snippet, it brings you up as dialogue where you can give it a, um, give it a, a name, you’d put your content and you put your message in, and then you can either, or to detect, or you can choose, you know, kind of what kind of language it is for the syntax highlighting. Um, so Amin, so it’s features like this that are, that I want to kind of highlight.

62:00 I mean, is there apart from the hitting enter to submit, is there any other kind of annoyances with, with Slack that people, um, people want to discuss? And maybe I can, I can add something in there. It’s more on behavior. Yeah.

62:19 Which I’m sure You’ll address as well. Uh, it’s very easy in Slack. If you see somebody asking a question to just reply in a new threat there, and then it’s happened to me multiple times that I see somebody asking her, I reply in the thread, then I’m scrolling

62:48 Something I’m addressing is, you know, bind to a problem, click the little thread key and replying the thread rather than just adding a new comment below. Yeah, absolutely. Yeah.

62:59 And it also makes it much more passable, right. Because otherwise questions can get lost. Then if there’s 20, 20, um, 20 comments and then someone posts their own question, they’re not,

63:15 Thank you. The question gets lost. And then, um, that’s not good for them really. It’s not a good experience for them. So yeah, no, that’s definitely something I’m address gonna address, which is kind of the reason I kind of started, um, this idea and then it just kind of escalated. Oh, well maybe we can do more.

63:32 And I did coach snippets and all these kinds of things.

63:37 Yeah. So I don’t know what form this will be. I’m going to write it and then just see how big it is or how long it is or whatever. I’ll stop sharing my screen now. Um, and, um, so it may be that we publish as an article and just give you a link to it.

63:52 And it’s for members only, or it may be that it’s just a PDF or I don’t really know what, what format it’s going to be, but that’s kind of what I’m going to be doing over the next week or two.

64:01 So if anyone has any suggestions or, or anything comes up between now and then just hit me up in Slack to send me a message, a message. And if it’s not in there, I’ll be happy to add it in.

64:20 Yeah. Thanks for that. Um, I think that’ll be good. Uh, not only for Slack newbies, but also for intermediate Slack users like myself. Yeah. I mean, there’ll be, there’ll be stuff that, um, Slack can do that even advanced users won’t know about. So, um, which, you know, a little kind of everyday improvements. Um, and also we also have to bear in mind that English isn’t the first language for most people.

64:47 So I think being able to navigate software that’s in English primarily, I don’t think slacks ships in different languages does it. I’m not sure. Yeah. Maybe I’m wrong there, but you know, navigate if your version is in an English version and you’re trying to navigate it in English, isn’t your first language languages can make it more difficult.

65:08 So, Yeah. Yeah. Cool. Well, um, yeah. Um, if anyone has any suggestions or Questions, feel free to ping Ricky on, on Slack or, or ping me and I’ll pass it on to him. And I think that’ll be good for, for everyone just to learn how to use Slack more efficiently and, um, yeah, good stuff. All right guys. Well, um, we’re about eight minutes or so over, over time. And, uh, I got to get on with the rest of my day here, but, uh, it’s been a lot of fun, uh, talking to everyone and Senia and I hope, uh, you guys got some good information out of this. And, um, what I’m going to do is, uh, post the chat in the Slack in the office hours, Slack channel, uh, and then this’ll be the third week that we’ve done, uh, recordings. Uh, and so we’ve now got a little bit of a backlog I’m going to work with, uh, Dan Bader this week and try to get those set up as, uh, uh, set up on the website, uh, so that we’ve got the, uh, history, uh, that you guys can go in and rewatch stuff and, um, and, and everything. So, um, we’ll get that set up and I’ll, I’ll post the link to that for you guys to find it.

66:24 Thank you. Yeah, appreciate it very much. Yeah, no, no problem. Can I, thanks. Thanks so much for coming and participating in San Diego, Andrew and Robert Wade and Ricky and Bartusch and everyone that everyone that’s here. So, uh, appreciate it.

66:40 Okay guys. Thanks. Thanks, bye.

Become a Member to join the conversation.