Python Bytes - #303 This title is required or is it optional?

Episode Date: September 29, 2022

Topics covered in this episode: Human regular expressions revisited Implicit Optional Types Will Be Disabled by Default cython-lint difftastic - structural diff Extras Joke See the full show not...es for this episode on the website at pythonbytes.fm/303

Transcript
Discussion (0)
Starting point is 00:00:00 Hello and welcome to Python Bites, where we deliver Python news and headlines directly to your earbuds. This is episode 303, recorded September 27th, 2022. And I'm Brian Ocken. And I'm Michael Kennedy. We've got a lot of great stuff to talk about today, and it's a wonderful September day. It's finally kind of not feeling like the blazing summer, but it's still too hot. It's that lovely fall before it rains for 120 days straight like the pre-fake fall yeah exactly exactly all right well what are you gonna python news still flows in the fall yes all sorts of good stuff yeah but what i got on deck for us
Starting point is 00:00:39 is a bit of a follow-up so i got got this message from Mikael Honkala, who sent over this repo that he put together. It says, you spoke about Humre, Humre, H-U-M-R-E. And he said, you know what? There's a bunch of these projects that I'd really like to kind of get my head around them. And so he went to all the trouble
Starting point is 00:01:02 to like do a whole research project and a categorization or a taxonomy of these different libraries, which is really fantastic. So I'm linking to his GitHub repository. That's basically a read me. I mean, GitHub's kind of the new blog for code analysis, isn't it? And it, it says RE for humans, regular expressions for humans. And it says, there's, regular expressions for humans. And it says there's a bunch of different options. This list could be useful to help you decide. If you're looking for a tool, you'll just know what's out there.
Starting point is 00:01:35 And you'll get a quick look and feel of how each library's API is. Or if you're thinking about building a tool, you can check out the alternative approaches and either contribute to an existing package or see if your thing is truly unique. And if you're building a tool or already have one, you can communicate your differences compared to the other libraries. So there's a bunch of packages listed here
Starting point is 00:01:57 with some code examples. So the first one Mikio calls flow style regular expression generators. I would call them fluent style, but where you say, you know, function call dot function call dot function call dot function call. Basically, the result of working with a library or calling a function, it returns the same thing again and again. And you can kind of build it up. Like ORMs are a lot like this. You know, you say like objects dot filter dot order by dot limit dot sort, like that kind of build it up. Like ORMs are a lot like this. You know, you'd say like objects.filter.orderby.limit.sort,
Starting point is 00:02:28 like that kind of model. Okay. So these include Python verbal expressions, edify, MRE, regularize, and RE underscore patterns. And they all are similar, but not the same. So I'll just, I'll read something off the top one, the Python verbal expressions. You would say ver x for version expression, dot anything, dot then space, dot then left bracket, dot or, parenthesis. So square bracket or open square bracket, open parenthesis, then dot anything. And that'll generate a regular expression that would then go and match basically like star and then space and then either square bracket or a parenthesis open. What do you think? I don't know if we're getting better
Starting point is 00:03:16 than actual regular expressions at this point. All right, well, let's go to the next category then. These are categorized as plus style regular expression generators. I would call them ones that like overload operators, right? They override what plus means and the pipe what that means. And it's a little bit like what PathLab does for forward slash or time delta, right? Yeah. So here I could say, you know, this includes the humeret.
Starting point is 00:03:45 That's the one from Al Swigert. So this, the, let's see, which one of these do I think that I like the best? I'll probably go with this first one here. So you could say capture one or more of anything uppercase plus the empty string or the string of the space rather, plus either the open parentheses or the open square bracket. Is that one?
Starting point is 00:04:06 Do you like this style better? Well, I'm probably a bad one to ask because I actually don't have a problem with regular expressions. Sure. Well, neither of these two are my favorite style either. I actually think I would use the format strings, which is the third category. And the reason I say that is it's
Starting point is 00:04:25 really different than regular expressions where these are kind of like a semantic wrapper on regular expressions you know there's like a way like i call functions i give a name to the thing instead of just the symbol like uh plus versus you know plus right and star star uh dot star it could be anything or you could say you know anything like also dot star. It could be anything, or you could say, you know, anything. Also with all of these, they have a special syntax that they use. So you don't have to learn regular expressions exactly, but you still have to learn their syntax. Yeah, that's true.
Starting point is 00:04:56 So when I might use one of these libraries is when it's like not enough to go do full on regular expressions, but you know, find is not sufficient or index, things like that. And that's these string format styles. So if you knew I had like a log file or something, and it said power colon, some number, percent, a string, and then a temperature, then another number, you could just say power, this is the scan F library, power colon percent F bracket percent, percent S comma, then temp.
Starting point is 00:05:32 So you basically, the format string you would use to generate this thing can now be used to parse it in reverse. And so it'll say, you have to have the word power colon and then a floating point number and then and so on. That's the older that's that's the Python two style, I suppose. Then you have pars and simple match, which are both much more F string style.
Starting point is 00:05:59 So you have these are great. So like I'm looking at parse and that looks pretty cool. So here, yeah. Parse the, it says, here's the regular expression pattern thing you would make. You would say just as a string to get curly bracket amount, colon D item, colon W comma, meet me at curly time. Right. And it just goes and finds the amount, the time and the item as a beautiful, you know, it just as a beautiful, basically it's a reverse F string is what it is.
Starting point is 00:06:29 So if you can express what you're looking for as an F string, then all of a sudden you can get it back. And so for those kinds of matches, I think this is really, it's pretty different than a regular expression. It is, but it's especially those ones where you're not just trying to match a string, but you're trying to pull data out where the regular expressions really get ugly. They do. You're like, I got to have a capture group and all this stuff. And you're like, oh, geez, how do I do that again? Exactly. And the capture groups, and it's guaranteed to confuse somebody on your team, but something like this, I think is pretty neat.
Starting point is 00:07:03 Yeah. It does mean the data has to be more structured but if it's highly unstructured go crazy with regular expressions if you just need more than like i said a little more than finder index this is pretty cool yeah yeah there's some wacky things that really you need to jump into regular expressions or um or the the the other kinds indeed all right well uh mikhail put um his thoughts on which ones to pick and win and then a little bit more diving into each of these and some some comparisons and whatnot so you can check this out it's really good work if you know of other ones maybe contribute to
Starting point is 00:07:39 them or add some more explanations but this is really nice yeah yeah this is real nice i'm gonna start it looks like i may have already started so that's good thanks mikhail for add some more explanations, but there you have it. This is really nice. Yeah, this is real nice. I'm going to start. It looks like I may have already started, so that's good. Thanks, Mikael, for sending that in and creating it. Well, what do I got? I got just some sort of news-ish sort of things. So I've been playing with Pydantic and FastAPI a lot. And with that, you've got types.
Starting point is 00:08:06 So you're, you're intentionally adding types, not just because you want my pie to pass, but you're adding types because it helps you. You can't have to for fast API and stuff and pedantic. So one of the things I, one of the things I was curious about is the whole, the optional part, because somebody actually caught me on this.
Starting point is 00:08:29 I have this, I tend to just say like int x equals none, or no, x of type int equals none. And that means it's supposed to be an integer, or it's supposed to be a string or something, but it doesn't have anything yet. So the default value is none, but none is obviously not a string or an integer. So, right. What do you do? Um,
Starting point is 00:08:53 and so there's like a bunch of options. One, you could just say, well, the language allows it. So I'm going to do it anyway. Um, but I don't recommend that.
Starting point is 00:09:01 The other, the other is one option is to use optional, but, uh, there's some issues with that. We'll talk about those in a sec. And then another is, uh, just to a union or in, so you can use, you use like int or int bar, none or union event and none, uh, and then assign it to none. And, um, and so I, uh, for a while, like when I, I'm like, the language allows it. Just go find.
Starting point is 00:09:30 Because what I really mean, my intent is I expect somebody to pass in, in this case, an integer. But if nobody passes, if they don't pass anything in, I want the function to handle that case also. And so that's what the none is for the union is a little weird because it says you can pass in a none and and i that would be weird for somebody to pass in none but that's what our language is also it like that's the default so i put out this um i put out a little survey the uh the recommendation that of the 630 votes the was either use the union or optional it's kind of people are kind of on the fence about with that um but um so adam johnson says replied to just the other day said well um my pie just released
Starting point is 00:10:20 and they they don't deprecate this yet but there's going to be a future deprecation of implicit optional types so you kind of can't use the old style if you're using my pi also you should the old style being int equals none yeah um of just like ignore the type for the default value um so uh my pi uh the my pi 0.9 0.981 i don't know why we're not where it's zero version still but um whatever um but it has it talks about implicit optional type so this uh yeah of saying it's a string but the default value is none that's that's bad. We don't want that anymore. What we want is optional. We'll say we'll work and we'll say, you know, then this is the weird part. So the weird part is optional isn't optional.
Starting point is 00:11:16 So what I'd like to use is optional. Like in FastAPI, it looks nice to say this variable is optional. But what really optional means is just that optional just translates to the type or none. That's it. Those are the types. It doesn't say it's actually optional. It's only optional if you have a default value. The default value makes a variable optional. Yeah, you can have a thing that explicitly says this type is
Starting point is 00:11:45 optional but it's a required parameter which is a little odd right yeah what's up with that yeah so a required optional um so anyway the third parameter named such and such of this type is required like but it's literally of type optional yeah i hear you okay that makes sense so the the basic gist is you have to pick you got to pick either optional use an optional and then assign it to none or use um use a union but another you know another uh option is just to actually assign something other than none so if it's a string you could have a a flag value to say like sentinel yeah that means like an empty string like a a great one for a string is empty string the the problem is with numbers like a floating pointer
Starting point is 00:12:30 an integer number there aren't any sentinels sentinels i mean i guess you could use nan um not a number but yeah it's weird um anyway uh wanted to reference typing so just to say my proof that optional is really just the union of the type or none it doesn't say anything and there and they they explicitly say in the python documentation that you can uh um you basically you don't have to use option the the keyword option or you could just put a default value that makes it optional but yeah it's only a type anyway um but the other thing the last bit i wanted to talk about with this is the best introduction this if you're confused
Starting point is 00:13:10 like i still am apparently about this the best discussion that i've found is in the fast api docs um and go to there's a python types intro and uh like at the top part way down it says possibly none um and it discusses all of this and the fast api recommendation is is to use union instead of optional and i think i've finally gotten there that i think i prefer just the either union or if you're in the bar thing so you can say type or like type bar none and that that's if you're only if you're python 310 that works but uh if you're the on the others i would use union so ah there's a bit of a um a voting in the audience alvaro says int or none which is a voting for that one. Anthony says, I prefer optional of int equals none myself. I also concur with Anthony, but I still very much would love to see some language syntax
Starting point is 00:14:15 that's a little bit cleaner. Like in C Sharp, in Swift, they just have question mark at the end to say it's either can be none or it can be its value and it's just such a common thing to set something to none and then or alternatively have its value that i would just i would love to see some kind of simpler syntax there than than we see now but yeah or some other some other sentinel that like like, doesn't SQL have like null or something like that? That's just, that's not a legitimate value for anything. Yeah.
Starting point is 00:14:51 And also if we use, by the way, one more reason I think people would want the question mark or something I think would be cool is it gives you this tonal inflection, right? Like this function takes an int, boom, hard stop. Like that means it has to be an int. Or it's like an int? Well, then you're not sure, it's optional.
Starting point is 00:15:11 Or you're not sure what type it is. Yeah, exactly. I think it's an int. Yeah, so int question mark, come on. It's in a lot of the other languages that have this like things that can't be nullable unless you express their null, you say they can possibly take on their value or null anyway i i know this has been discussed and and shot down but
Starting point is 00:15:30 yeah please make it happen and i was pretty sure you could do this thank you um alvaro mentioned that you can use uh you can use from future import annotations to use the bar for everything on three eight and above above. So that's good. And, but like, like for, like, if I'm doing a fast API, the optional is really what I mean. And that, that, I mean, it's optional, but it's frustrating that the type optional doesn't actually fill in anything.
Starting point is 00:15:58 Yeah. Yeah. So a bit of a mismatch there. Okay. That's enough. That is enough. Enough on that. that it's it is so good though good stuff that those types are there brian you want to tell us about our sponsor for the week sure um so microsoft start microsoft for startups founders hub it's uh it's very cool so microsoft this episode of python bytes is brought to you by Microsoft for Startups. And the Microsoft for Startups Founders Hub provides all founders at any stage with free resources to help you solve startup challenges.
Starting point is 00:16:36 And it's a platform. The platform provides technology benefits, access to expert guidance and skilled resources, mentorship and networking connections, and so much more. And those, those skilled resources and the one-on-ones and the, the networking, it's so valuable. So unlike others in the industry, Microsoft for startup founders hub doesn't require startups to be investor backed or third-party validated to participate. It's truly open and you don't have to live in San Francisco. So what do you get? You get free access to GitHub and Microsoft cloud with the ability to unlock credits over time. And they also have partnered with innovative
Starting point is 00:17:16 companies like open AI, a global leader in AI research and deployment to provide exclusive benefits and discounts through the the Founders Hub, becoming a founder is no longer about who you know. You'll have access to their mentorship network, giving you access to a pool of hundreds of mentors across a range of disciplines, across areas like validation, fundraising, management, and coaching, sales and marketing, as well as specific technical stress points. And you know that there's at least one or two of those fields that you need help in. You'll be able to book a one-on-one meeting
Starting point is 00:17:50 with the mentors, many of whom were former founders themselves. Make your ideas a reality today with the critical support you'll get from the Founders Hub. To join the program, visit pythonbytes.fm slash Founders Hub 2022.
Starting point is 00:18:05 And of course, the link is in our show notes. Thank you, Microsoft. All right, let's talk about linters. I know you're a fan of linting code and making it look good, as am I. But if you did Cython, you might not be able to get great information about it. So Marco Gorelli sent in this project that he's just getting started called Cython Lint. So have you done much Cython? I know you do C and you do Python, but do you live in this weird middle ground? I don't, but I want to, or maybe I don't,
Starting point is 00:18:38 I don't know. I think it's pretty neat., like a bit of a build step you got to go through to get code that will run. But the ability to just say, I wrote Python, it has type in, it's like, oh, let's just do a little bit different code. And now it runs at C speed for just like a function or two. I think that's a pretty appealing idea. And, you know, Cython is definitely a good way to do that.
Starting point is 00:19:00 So Cython Lint, we'll go through and, you know, you can just pip install it and then run it as a command line, give it your files. Or you can even install it as a pre-commit hook. And then, you know, just whenever you commit, it'll obviously run as well. Just like the no QA in Flake 8, there's a hash no Cython Lint to turn off the lines. And right now it mostly checks things around variables. But he's working on more. And hopefully other people out there are interested in this and can add some ideas too.
Starting point is 00:19:32 This is really cool. I hope that he does get people helping out and adding to this. Definitely it was something needed. Yeah, he said he ran it on Pandas, Numpy, scikit-learn and QPy and found ways in which all those libraries could be cleaned up. So pretty neat. And all those libraries are notable because they're really highly, highly used and have been around for a long time. So if this is finding issues with them, then, you know, maybe it points out that something like this should exist. Yeah, definitely. Yeah. Cool. So not a whole lot more to say about it.
Starting point is 00:20:06 You know, Cython's cool. Having some more tools to support it, also cool. Yeah. I've got another sort of possibly short topic. I found out about this cool diff tool called DiffTastic. Have you seen this before? DiffTastic? I don't think so.
Starting point is 00:20:22 I'm always looking for a better diff tool. I'm never really content with my diff tools. I use one called Beyond Compare. It looks like it's cutting edge out of the early 90s. It's useful, but boy. within it with it with respect like within with git so i do uh you know you're doing a git diff of uh of older versions or something so diphtastic is uh the what's what how it stands out against other diff tools is it's not line based so it's a um it's a structural diff tool that understands syntax so what it does is it evaluates uh the language it tries to determine what language the file is in and then uh if it like and it's got a ton of languages and if you it figures out like it's python for instance or any other language it creates an abstract abstract syntax tree of the files and then checks the differences of those
Starting point is 00:21:23 so uh in the past, like one of the things that messes things up is just spacing problems. Like in something like C or C++ where spacing doesn't matter, you can just say, well, ignore whitespace. But in Python, you really can't say ignore whitespace because whitespace is significant.
Starting point is 00:21:41 But with the DiffTastic, the diffs will know know you can if it's significant white space it'll tell you so um i tried this out this morning and it's it's pretty amazing so uh i tried it so the thing i tried was uh replacing with the diff tool so there's a with get so in get you can you can say and i just tried this single line thing to just temporarily say i want to try get diff it has is diff t instead of uh instead of get diff um so what this does is it does a diff and there's ways on in the uh in the documentation that where you can permanently turn it on but but it's colorized.
Starting point is 00:22:25 So you've got like syntax highlighted files side by side, and it'll show you what's different and it highlights the difference. Well, I got a little bit confused because the syntax, there's syntax highlighting and highlighting to show you the difference. So there's a flag and I, I'm not sure where it is in the documentation, but basically you just turn off you say dash dash syntax highlight equals off so it turned it turns off the file syntax but it shows so all the highlights are just diffs um and so like if you if you normally say get diff
Starting point is 00:22:59 just without anything it'll say what's different about my my file versus the last version or the working directory or whatever like what what it usually does the right thing and um and then but it's like on top of each other it's not side by side so having it side by side is cool and having a highlight so i had a uh some code where i changed stuff and i've been working at a month ago or so, and I forgot what I did and get diff showed me just tons of changes, but diphtastic showed me that I was just changing some, some minor things like adding types, a couple of types here and there, or changing a double quotes or single quotes,
Starting point is 00:23:39 double quotes. So I apparently ran black on it at one point. And, and there was like, sin ast wise there's really nothing different so i can just commit this and be done with it um so it's really helpful it is a pretty interesting idea right sometimes you really care about those little formatting differences and you want to make sure they get merged and committed and other times you want to know what is the essence of the change and this sounds like that'll answer that. That's pretty cool.
Starting point is 00:24:05 And it showed me a bunch of stuff that get says there were file changes, but get, but diphtastic said there's no, there's no syntax change. So I, I apparently had changed some, you know, light, some formatting or something or ran black on it, but there was nothing significant change. So interesting on that. Um, and apparently this was a huge pain in the butt to make. Um, and, uh, and there's a, we're going to link to a blog or blog article called, uh, diphtastic, the fantastic diff, uh, by, uh, Wilfred Hughes, who wrote it that basically said he thought this was going to be sort of a minor thing to build and it was a
Starting point is 00:24:45 big thing to build so six months later yeah i'm not sure how long he spent on it but yeah but yeah and here's a here's a image of the little different highlighting the colors of changes and stuff so anyway it's nice yeah looks like a great tool i've never heard of it thanks for thanks for finding it alvaro out there says code dash dash diff. I'm guessing that's VS Code diff. I've never done anything with VS Code diff. I haven't used that for my command line. I should try that.
Starting point is 00:25:13 Yeah, perhaps. Okay. Also, one that I've been looking at that I haven't gone and used is this one called Kaleidoscope. That's just for Mac only. But it looks pretty interesting. It's supposed to work on code but also on like uh directories but you know images and other documents as well so i don't know
Starting point is 00:25:33 maybe someday the only challenge it looks beautiful the only problem that's not a problem it's the thing that has held me back is it's 150 so it better be darn good at least there's a free trial maybe i'll try it someday. I volunteer you to try it out and get back to us. Exactly. Let me know how that goes. Yeah. All right.
Starting point is 00:25:54 Well, that's our items, right? I got an extra if you're ready. Yeah, let's go to extras. So this is not a Python thing, but a thing that developers may be interested in. Have you heard of NextDNS dns no so one of the things that's a big hassle is spyware tracking you know all sorts of trackers like fingerprinters and you know facebook cookies and all these different things that are trackers, which is not lovely, but also malware as well.
Starting point is 00:26:26 And a lot of those are being served off of third-party domains. So there's this product called NextDNS, and I'd never heard of it, but apparently it more or less acts like a firewall by not allowing malicious or unwanted things to resolve over DNS. Wow. So what you do is you just, you set it up and you just set your DNS server to be, you know, one, seven, two, four, or whatever their DNS server number is. And then it goes, everything goes through there. And if it says, Hey, we're trying to go to double click, you know, like, no, we don't know what double click is. It's not on the internet. I'm sorry. And just,
Starting point is 00:27:02 there's no more ads. So it blocks a lot of the ads and trackers and because it's a dns service and not like um an ad blocker in your browser it works on whole devices so you could set it up on say your router and then everything including your television and the mobile apps and everything on they would all get this blocking which i think is pretty cool pretty interesting yeah i'm definitely going to check this out i'm not quite ready to set it up on my my router yet because every now and then you you basically are forced to turn off your ad blocker for some small weird website or do i want to impose this on my wife? Maybe, maybe not. Do I want the tech support? So I'm on the fence, but I think it's a neat idea and I might play with it as well.
Starting point is 00:27:52 You can always get it and just set it on your, your computer. Right. But if you wanted to like every device I have automatically gets malware and add tracker blocking to put it on your router. Yeah. So, so one of the things, uh, Oh, do you have any other extras? No, that's it. Okay.
Starting point is 00:28:07 So one of the things I've been trying, uh, to block ads and stuff is, is I found out about this, um, uh, a VPN called mall that mall VAD, I don't even know how to pronounce that.
Starting point is 00:28:18 Um, but it's pretty, it's been pretty good. Uh, it, it blocks a whole bunch of stuff. Um, of course switching to
Starting point is 00:28:26 vivaldi helps uh you can turn you can have vivaldi block stuff but mulvad is so um so uh like into security that it doesn't even ask for a password or or an email account or anything so what you do is when you sign up it gives you an account number and you just have to write that down and use that. And to pay for things you can use, they encourage you to use cryptocurrency or something, but you can use cards or whatever, but that potentially could tie you to them, right? So they also allow you to just put money
Starting point is 00:29:02 in an envelope with your account number and just mail it to them. That's awesome. They'll add money to your account. So anyway, that's pretty neat. I've done a massive amount of research on VPNs and there's a really whole bunch of shady ones out there, but Mulvand and NordVPN,
Starting point is 00:29:20 those two come out really, really good. And so I've heard of great stuff from all that. I use NordVPN. And the reason I'm not using NextDNS or something like it is I just run NordVPN and everything and check the block all the ads over that as well. So it's very, very similar. So yeah, I think this is a great solution and basically do the same thing. I also wanted to remind everybody that the current, this is a little bit old news, but the current Python 3.11 is Python 3.11.0 RC2.
Starting point is 00:29:52 Definitely worth people trying out. And definitely, if you've got a module that you're, you should have been doing this already. Shame on you. But if you've got a package out there on PyPI and people are using it, you should be updating your testing
Starting point is 00:30:03 to make sure that it's testing the latest Python 3.11 to make sure it continues to work. The last extra I wanted to bring up is, I saw this the other day, called Oh My Git. And so this ends up being, what it is is it's a little game, and it's a little weird, but I tried it out, downloaded and tried it out. And so you've got, most of it's a little weird um uh but i tried it out downloaded and tried it out and
Starting point is 00:30:26 so you've got most of it's like this sort of a view and so you gotta like a there's a workspace area in the middle there's cards at the bottom and the cards are skills that you get but it's in the and on the right there's a description of what you want to do and you have to like learn the git commands to do something um like uh rebasing or merging or whatever and um the i i started out at the trying out at the very beginning the basic stuff and it actually was the introduction was pretty cool and then but what i really like is that you can just go to the course, the, the, the available, uh, available lessons. You don't have to do it in order.
Starting point is 00:31:10 You can jump out of order and just hop ahead to something else that you're having problems with and sort of have a visual introduction to, to get. So it's kind of neat. That's weird and kind of wonderful. It is a little weird too. Yeah. Yeah. very cool all right uh one more a quick follow-up uh wagon race out there says i know but we don't ads but ads are the reason most stuff is free or do you want to make a donate or you know do you make donations to sites that you block ads from i just want to comment on that real quick i understand that there's a lot of services that do need support.
Starting point is 00:31:48 I mean, I was just listening to an interview with the guys from The Verge. They have a hundred person team at The Verge working on stuff. And yet there is so much like collection and triangulation of who you are and what you are by these ad networks through like data brokers and behind the scenes stuff that is just, it is a plague on society. I mean, think about the 2016 election and the Facebook stuff. God, what was that name of that company? Do you remember Brian? But don't. But yeah, so they were using all those things to basically that kind of information collected from those
Starting point is 00:32:26 ad networks to target and manipulate people. So it's not just about like, do I not really want to see this ad for a new program programming book or whatever? It's, it's not, it's the fact that they're using these terrible third party networks to deliver it. So for example, Brian, check this out, pythonbytes.fm, right? If we go here and we go to our episodes and let's just pick one here.
Starting point is 00:32:52 I got to zoom it back out a little bit. There we go. Look, this one right here, it has an ad. That's being, there's an ad blocker on my VPN on the network and there's an ad blocker in my browser. And right here, we have an ad with no blocking. It shows up just fine. Do you know why? Because we're not using an evil third-party network there's no tracking there's no retargeting we show you things from people who support us we we ask you to please
Starting point is 00:33:17 check them out and at least consider it to support our show and yet there's as much ad blocking here as there is on somewhere like CNN or, you know, you pick your spot. These places have like 30, 40 different tracking networks on you, triangulating stuff and reselling it. And it is a plague on society. And if CNN wanted to show you ads, they could do just what we do. I'm sure they have better relationships with advertisers than we do. So Cambridge Analytica, thank you for letting me know. So I'm not against ads. I mean, to a large degree, we are ad supported. I'm against people building behind the scenes information and using it to manipulate society.
Starting point is 00:33:58 Bit of a rant. Sorry. Sorry, Brian, if I went too far in there. No, they had, and some people just don't realize that, that the ads are not just, there's a product that we think that you might like based on the content of this page. That totally makes sense. Like this, uh, the people that are listening to Python bytes, they might be interested in Python or Microsoft for starters founders up something. Magazines used to be like this all the time, right? So you buy a magazine, it's not tracking you that whether or not you looked at something or looked up somebody's website because of a magazine ad.
Starting point is 00:34:30 There's it, there's just stuff collected about you that I don't think is necessary. And I think like, for instance, read the docs has like the ethical ads that they don't do. Yeah, they don't do tracking. So yeah, exactly. And do tracking. So, yeah. Exactly. And neither do we. On purpose. Probably, we've had to turn down sponsors.
Starting point is 00:34:56 People said, we want to sponsor you, but we need you to install this tracking thing for your MP3 downloads. We need to install this Facebook pixel and these other things. We're like, you know what? We don't want your money. Like, no. We're happy to sell your product because it's relevant, but we're not going to spy on our users. So thanks, but no thanks. All right.
Starting point is 00:35:09 And Wagon Race, just a quick follow-up says, thanks for the explanation. I do understand you better and I'm glad you guys are big enough to have direct sponsors without trackers. So are we. Thank you. Okay. With all that, let's flip the table and make something, close it out with a joke.
Starting point is 00:35:26 What do you think, Brian? Yeah, I'm ready for something funny. All right. So this one comes from somebody who wanted to go through this online, multiple choice, prove to me you know JavaScript test to be hired. Okay. And it says, so I got this wrong because the person who typed in the question made a mistake. So here, check this out.
Starting point is 00:35:50 It's one of these multi-choice question things. It says, what is the result of the function call shown below? And it's just super simple JavaScript. It's creating one of these little lambda expressions here. And it has the equivalent of an F string and a interpolated string is really the essence of it. And it says console.log, open parenthesis, this is important, as you would, open parenthesis, quote, hi, my name is, you know, dollar curly first name, close off the curly. And then it closes out the console log
Starting point is 00:36:21 instead of with a closing parenthesis, with a closing curly brace. And so the options are like, hi, my name is John. I'm logged into the console log instead of with the closing parentheses, with a closing curly brace. And so the options are like, hi, my name is John. I'm logged into the console. Hi, my name is Undefined. I'm logged into the console. And what the machine thought was a correct answer is, hi, my name is John Jr.
Starting point is 00:36:36 Because that's the name of the variable, the value variable. I'm logged into the console. And you answered, uncaught syntax errors logged to console. They're like, no, wrong. It was supposed to say John Jr. No, wrong. You typed it in wrong.
Starting point is 00:36:55 Wouldn't that be frustrating if you're trying to apply for a job and they put syntax errors in there and you're like, nope. Because they may be checking whether or not you're finding that closing curly brace, right? That's a legitimate test, guess but no yeah and i think it's fine that you don't get to work for them because they're probably not someplace you want to work for they've got syntax errors and they're onboarding exactly in their application process but exactly oh well anyway i thought that was pretty funny and i'm sure people have been through the like there's all these sort of weird go home and write this test or take this thing to
Starting point is 00:37:31 prove you know how to write code sort of things i'm sure people have been through so they'll probably get a laugh out of this uh yeah that's pretty funny all right it was well should we wrap it up let's cool so thanks everybody for coming and watching the show and also everybody that listens we love all of you and thanks michael indeed thank you everyone thank you brian yeah see you next week

There aren't comments yet for this episode. Click on any sentence in the transcript to leave a comment.