- Podcasts
- Python Bytes
- #140 Becoming a 10x Developer (sorta)
About this episodeTopics covered in this episode: Becoming a 10x Developer: 10 ways to be a better teammate quasar & vue.py Regular Expressions 101…
- Becoming a 10x Developer: 10 ways to be a better teammate
- quasar & vue.py
- Regular Expressions 101
- python-diskcache
- The Python Help System
- Python Architecture Graphs
- Extras
- Joke
Transcript
From the publisherThis transcript comes from the podcast’s own feed, shown as the publisher wrote it.
#140 Becoming a 10x Developer (sorta)
More on that later. Brian, how you been? I'm doing great. Yeah, wonderful. You? Yeah, very good. I just got back from a camping trip in Astoria, right on the coast there. And it's nice to get away from the computers for a couple days. Yeah. But it's good to be back. So the Python news, it has been flowing even while I was gone. So that's pretty awesome.
Kate Heddleson put together a article called Becoming a 10x Developer, 10 Ways to Be a Better Teammate. And I read it, and that's actually a lot of great advice. So a quote from her is, a 10x engineer isn't someone who is 10 times better than those around them, but someone who makes those around them 10 times better.
Which is humbling because I don't think I do that. I try, but you know. Do you feel like that's not properly rewarded? Like in business and projects and stuff, like what gets measured gets optimized, right? And if you're in an organization where they don't take that as a major factor into like how you're doing, like, well, what features did you ship?
Like what things did you work on? And so on. If your job is to kind of float around and make sure everyone is like not hung up on how to use this API or they don't know this backstory on how to use this thing or why it is the way it is. Like if you spend too much time doing that, are you like hurting your career?
I think it probably definitely depends on the organization and probably even within a company, it changes based on like what division or what group you're in or something. Yeah. And I've certainly seen places where it's highly valued and it's like recognized and other places where it's like, well, but what have you been doing?
Seven, cultivate excellence in an area that is valuable to your team. Eight, educate yourself about diversity, inclusivity and equality in the workplace. Nine, maintain a growth mindset. And last, advocate for company policies that increase workplace equality. I don't think there's anything to argue about, but this is good stuff.
Yeah, these are all great things to keep in mind. And Kate's definitely been a voice for these types of things for a long time. So it's good to see her put it in the context of this 10x story. And I encourage people to read the article because every one of these, if you're like, I don't know how to do that.
She gives actionable advice on what you can do to increase any of these. So it's good. Yeah. Cool. This next one that I want to talk about here is interesting. It's a little bit more JavaScript-y than the stuff that we normally cover. Normally, it's like pure Python. But I feel like there's enough tie-ins together here.
So this one comes partially to us from Doug Farrell, who's done some cool articles over at RealPython. He's been on the show before and things like that. So the first thing that he sent over is this new framework called Quasar. And Quasar builds on top of Vue.js, right? Now, if you're going to build some kind of front-end JavaScript thing, you know, maybe it's going to talk to Python on the back-end, a bunch of APIs you're going to write.
So Quasar, what it does is it builds on top of Vue.js, adding all sorts of cool components that you can use. And it lets you create many different types of apps. You can create a single-page application that is, like, an app that loads. You never really navigate away. It's constantly, like, updating itself through JavaScript.
That's cool. That's pretty cool, right? So if you could build that, that's great. And, of course, Python on the back end is, like, obviously a super, super good choice. I mean, that's how it is for my mobile apps, but Xamarin on the front end. But, like I said, it's great. There's tons of these things you can just drop in and get cool little widgets and progress bars and buttons and, you know, all the kind of things you need to build your UI.
No way. But there's this thing called Vue.py. And Vue.py provides all the bindings for Vue.js, runs on Brython, which is a way to put Python in the browser. And there's a bunch of cool example apps that are non-trivial that you can work with. So you just write pure Python code. If you want to create, like, a Vue.js component, you just derive from the component class in the Vue.py thing.
And the first time, it takes them, you know, maybe a couple seconds to download the Brython JavaScript and whatnot. But it's like a super cool little interactive little thing all in Python. You can check out the source. Neat. Yeah, definitely will. That's cool. Yeah. So I was a little hesitant to cover Quasar because it's pure JavaScript.
But if I can take Vue.py and then write this, then now we're talking. Now we're getting somewhere interesting. Now build on top of that that the Electron apps don't care about how much download time it takes or whatever, right? Because you ship it. Like, one of the things included with a Vue.js, sorry, an Electron app is Chrome, right?
Which is like 60 megs or more. So, you know, who cares if you throw in an extra 200K for, like, Brython JavaScript. So it could be a really cool way to build some desktop apps with Python and Vue.js. Yeah, I think that's a neat idea. Cool. Yeah. Anyway, it's kind of a cool mix of front-end JavaScript and some Python, maybe even in the front-end.
Yeah. Yeah, all right. What's the next one? Well, in episode 138, we talked about regular expressions a little bit. And I made a joke on Twitter about regular expressions. And then I got a whole bunch of people, like, giving me resources back. And there's a couple of them that I'm actually really excited about.
So the first one I want to cover is a website called Regular Expressions 101. It's at regex101.com. And I kind of wish I had this a long time ago. Because I know regular expressions are a little different in different languages. And this one, you can select Python or PHP or JavaScript or Go as the one you're working with.
And then you can just start typing in a regular expression example. Or you put in, like, an example string that you want to match. Maybe even some stuff you don't want to match. But then as you're typing the regular expression, it shows you and highlights the different areas where it's matching, where it's not matching.
And then since we also have match groups and multiple matches, it shows you how that works, too. And there's also, like, a little quick reference guide. It's actually mostly what you need. Like, for instance, I forgot the... I always forget how to do, like, if I want to match a character, but I want to match, like, one to three characters of that type, not just more than one.
I'm going to use this more. Man, I got to say, this is really slick. I love it. You can select it, like you said. You select the different language types. And it will even give you, like, assistance on what it means, right? So, I typed dot plus and it says, oh, the dot plus matches any character except for line terminators.
The plus matches one and unlimited times. And then I wrote a little capture group and it says, oh, the capture group means this and whatnot. And yeah. Oh, so, like, if you're looking at somebody else's code, for instance, and there's a regular expression you don't understand, you could pop it in here and it could, like, explain to you what it all means.
It just has two lists of strings and you're supposed to match the first list and not the second list with a regular expression and try to do it with the least amount of characters. So, possibly not. Well, I mean, you can do it with as many characters of regular expression as you want, but some of them, people have matched it with one character.
And I'm like, how? How did you match it with one character? Yeah. That's pretty awesome. And got some spare time, I guess. Well, you know, I'm a manager and all, so the spare time comes with the territory. That's right. Now, this regular expression 101 is a super cool web app, and I'm definitely going to save it.
Anytime I got to do regular expression stuff, I'm going to go back to it. Speaking of regular, tell me about our sponsor today. Yes, our regular sponsor, DigitalOcean. They've been sponsoring the show for quite a while, and they're doing all sorts of cool stuff. They got managed Postgres database services.
Very, very nice. And, yeah, they're great supporters of the show. A lot of our infrastructure runs on what they're doing. So, appreciate that and can definitely recommend them. Try them at pythonby.sad.fm slash DigitalOcean. Get a $50 credit for new users. Now, places like DigitalOcean and many of the other hosting spots that you might go and use, they're now offering SSD solid-state drives as basically a default option.
So, you get really fast disk access, right? Yeah. Yeah, well, if you have fast disk access and you can speak properly, you could actually use that as a cache, right? So, caching has huge benefits for making our apps faster. And a lot of the ways that people think about caching is they think about, I'm going to pre-compute some stuff and cram it into memory.
Oh, yeah. And that's okay. But, like, so, if you go over to, say, DigitalOcean and you fire up a server, the server comes with one gig of memory, but 25 or 50 gigs of SSD, right? So, if you're trying to squeeze a lot of performance out of your app, you could go buy, like, a super high memory version, or you could set up a separate server that's doing Redis or something like that, which still is also going to kind of run into that issue.
Or you could just use that really fast disk. So, this next, the fourth item I want to talk about is something called Python-DiskCache. I'm not going to give it a huge grade for creative naming, but definitely descriptive. Yeah. So, the idea is that we can basically treat this Python-DiskCache kind of like Redis.
But then as soon as it exits, it's gone from memory. Right? Then you run it again. Well, now it's got to start over. But if it's on disk, it's persistent. Right? So, that's cool, too. Yeah. Django itself has built-in caching, which is cool. But apparently, at least according to the author of this, I don't do enough Django to know for sure.
But apparently, the file-based cache in Django is essentially broken. If you listen to what he says. So, let me pull up the little section where he says that a calling method is random and large caches. Repeatedly scan cache dictionary, which is slow. You know, it could take, like, 60 milliseconds to store a key with a couple thousand items in the cache.
Yeah. And pytest. Yeah. And finally, you might say, well, I've heard of other things like this, right? Like, there's other types of caches like this. So, there's stuff called DBM and Shelf and SQL dict and PickleDB. And I think these are all new to me. But there's a bunch of these other similar types of things.
Right. I like the comparison. Looking at that table, it looks like disk cache is based on, or it stores the data in SQLite. And we know SQLite's really fast, so. Yeah. You already get indexes for efficient lookups and inserts and stuff like that. Yeah. So, cool. Very, very cool. So, if you have to cache stuff or you have things that are slow in caching MyFixit, this is actually a really interesting way to think about it.
Because the alternative of setting up other servers like Redis and then having to manage the connections and all that, like, that's great if that's something that works where you need it. But, like, this seems really simple. Yeah, and I was thinking along the lines of companies that store or are keeping track, like, for dashboards and stuff, they're pulling data from various places.
But it's – and people can look back in old stuff, but it's mostly the recent things that people are looking at all the time. And so, something that caches the more recent stuff makes a lot of sense. Yeah. And it's quite cool. Yep. What's the next one? Oh, yeah. It's my turn. Speaking of – I was just looking at the disk cache stuff and they were talking about how to learn more you can use the help system.
And in a Python REPL, you can, like, for instance, type help print. And then you do, you know, help as a function. And you pass it. If you pass an object or a built-in something, like print and dict or built-ins, you get, like, a lot of information. Like, if you type help dict, you get basically a tutorial on what all the stuff you get on dictionaries.
It's pretty nice. And I tried, like, in things that are keywords that are not objects, you can type help on those, too, but you put them in, like, quotes first. So, like, you can type help, quote, assert, and get all the information on how assert works in Python. And you can import stuff so it's not just the built-ins.
You can, like, for instance, one of the examples was import math and then help on math.log. And, yeah, you can learn about log. Like, I just did that to try it. And I'm like, oh, cool. I always forget that log can take a different base. So, you can do, I don't know, base 7 if you were just crazy and wanted to.
Yeah, and it's right there. And it even works with it. It's offline. It's great. You're right that help dict has a ridiculous amount of stuff in there. That's pretty crazy. I've never typed that. Shows you all the magic methods that are overridden and all the stuff that happens. Yeah, it's quite cool, actually.
Yeah, and the things that you can convert to dictionaries and, yeah. Yeah, it's a nice one. Keeping with the same line of thinking of, like, I have some code and I want to understand, like, how it works and how it fits together, right? This is, like, the documentation and some of the methods and examples and stuff.
But David said and sent over a cool couple of projects that he works on that is, like, a higher level architectural overview of Python libraries. So, I think these are created by him. And one is called impulse and one is called import linter. And the idea is that you get a quick picture of all the dependencies within a Python package.
Oh, nice. Yeah, so I could type impulse space draw graph space and then some Python package that's installed in the same environment as the impulse thing is. So, it can find it. And then it'll go and, like, look all through it and say, well, here's all the modules, submodules, classes, and so on that are referencing each other.
And it draws, like, a cool architectural graph of, like, this depends on that, which depends on that, and so on. Oh, wow. Yeah. So, it's a good idea to just run that against code that you're not super familiar with. So, like, before you go digging through the source code, like, let me just get a picture of what's in here and what's talking to what, you know?
If you want to run it, you might get an error that it can't draw the graph. You have to have GraphViz separately installed because it draws the graph and then it hands it, like, the data off to there to do the drawing. And if you're on a Mac, you can just brew install GraphViz, you know, just basically have that installed, and then you can more or less just run impulse draw graph on things.
It's great. Nice. Yeah, the other one, ImportLenter, allows you to check contracts about the dependency graph. So you can say, like, we want to prevent circular dependencies or other types of constraints. Like, this should never depend upon that. So you can run it, and it's like part of a continuous integration, and it'll tell you if, like, some rule you said this shouldn't happen, you know, it changes in terms of dependencies.
Oh, interesting. Yep. Yeah, this is cool. Yeah, I think I would definitely use impulse, the graph one, more than the linter, but I can see, like, depending on what you're doing, like, one might be more valuable than the other. Yeah, I mean, if you were teaching a class and you said, I want you to implement something, but don't use package X.
Do you got anything extra for us? I ran across something that I'm sure some folks know about, definitely the core developers know about, but I just, you know, it just made me laugh. I was just like, all right, this is funny. So I was working on some package, and I needed to understand it better, so I used PyCharm, go to definition, and took me inside the source code of some part of the standard library, and I saw it was importing TabNanny.
I'm like, what the heck? TabNanny. So TabNanny, as in like the babysitter of tabs or something, I don't know, is apparently a standard module, and it checks for inconsistent mixtures of tabs and spaces. And I knew Python checked it. I just didn't know that the thing that did that checking was called TabNanny.
So I thought that was funny. I thought I'd share that with you all. That's awesome. And there's a thing called BadTabs. Yeah, it's pretty funny. Yeah, nice. Yeah, so I guess one other thing, quick shout out, just to let people know that the Flask Data Driven Web App course is out, and people can give that a check out.
It seems like everyone's enjoying that. So if you want to work with Flask, that's also a good one. Okay. Anything for you, Brian? Nope. Just working away. The new office is working pretty good, but I've decided, like, last week I was sitting on the ground. I've got a chair this week, so this is good.
It's never the same. All right. So two threads walk into a bar. The bartender looks up and yells, hey, I don't any conditions race-like time last want. Yeah. Yeah. The next time you tell it, you could be like, hey, two threads walk into a bar. A barkeeper looks up and yells, don't any conditions I, hey, want race-like time last.
Yeah. Thank you. Yep. You bet. See ya. Thank you for listening to Python Bytes. Follow the show on Twitter via at Python Bytes. That's Python Bytes as in B-Y-T-E-S. And get the full show notes at pythonbytes.fm. If you have a news item you want featured, just visit pythonbytes.fm and send it our way.
