Brought to you by Michael and Brian - take a Talk Python course or get Brian's pytest book


Transcript #140: Becoming a 10x Developer (sorta)

Return to episode page view on github
Recorded on Thursday, Jul 18, 2019.

00:00 Hello and welcome to Python Bytes where we deliver Python news and headlines directly to your earbuds.

00:04 This is episode 140 recorded July 18th, 2019. I'm Michael Kennedy.

00:09 And I'm Brian Ekin.

00:10 And this episode is brought to you by DigitalOcean.

00:12 Check them out at pythonbytes.fm/digitalocean. More on that later.

00:15 Brian, how you been?

00:17 I'm doing great.

00:18 Yeah, wonderful.

00:19 You?

00:19 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.

00:27 Yeah.

00:27 But it's good to be back.

00:29 So the Python news, it has been flowing even while I was gone.

00:32 So that's pretty awesome.

00:33 Let's get started with your first item.

00:35 What do you got here?

00:36 Well, people have been, there's, I'm not going to get into the 10 X controversy too much, but there's some 10 X developer rubbish going around Twitter recently, I think partly for clickbait, but I'm not going to hold it against her.

00:50 Kate Heddleson put together a article called becoming a 10 X 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.

01:16 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. And 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?

01:48 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?

01:58 So 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? You know, it's not the best. Well there I mean there definitely has to be a balance You can't just be a cheerleader. Yeah, and a coach. We actually do need to get stuff done also. And actually I'm amused that it's a weird controversy that now that to say like that there's the 10x is 10 times better than average and I don't think it ever started out that way. I think it started out just of an acknowledgment that there's orders of magnitude between the productivity of the most productive people and the least productive people and I don't think that that's controversial. No it's definitely not. Whether or not you believe in the 10x saying these are great advice so I'm just going to run through them. Number one, create an environment of psychological safety and this there's a reference to Google study basically saying people are better creative work if they feel safe in their environment. Number two, encourage everyone to participate equally. Three, assign credit accurately and generously. Four, amplified unheard voices in meetings. I love that. Five, give constructive actionable feedback and avoid personal criticisms. Six, hold yourself and others accountable. 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.

03:33 Yeah, these are all great things to keep in mind, and Kate's definitely been a a voice for these types of things for a long time.

03:40 So it's good to see her put it in the context of this 10x story.

03:44 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.

03:53 So it's good.

03:54 Yeah.

03:55 Cool.

03:55 This next one that I want to talk about here is interesting.

03:59 It's a little bit more JavaScript-y than the stuff that we normally cover.

04:03 Normally it's like pure Python.

04:04 But I feel like there's enough tie-ins together here.

04:07 So this one comes partially to us from Doug Farrell, who's done some cool articles over at RealPython.

04:13 He's been on the show before and things like that.

04:15 So the first thing that he sent over is this new framework called Quasar.

04:21 And Quasar builds on top of Vue.js.

04:25 Now, if you're going to build some kind of front-end JavaScript thing, maybe it's going to talk to Python on the back end, a bunch of APIs you're going to write.

04:34 But it's going to be mostly JavaScript and front-end stuff.

04:37 Well, Vue.js, in my opinion, is really one of the best choices, right?

04:41 It's simple, it's easy to get started with, it works really, really well.

04:44 It's not as complicated or convoluted as like AngularJS or something like this.

04:49 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.

04:59 You can create a single page application that is like an app that loads.

05:02 You never really navigate away, it just is constantly updating itself through JavaScript.

05:06 a server-side rendered app, which is cool, a progressive web app, which is cool, but then you can also do mobile apps, Android and iOS, that's cool, and multi-platform desktop apps using Electron, like Visual Studio Code or Slack or whatever.

05:22 All of that with the same code base, based on Vue.

05:25 - That's cool.

05:26 - That's pretty cool, right?

05:27 So if you could build that, that's great.

05:28 And of course, Python on the back end is obviously a super, super good choice.

05:33 I mean, that's how it is for my mobile apps, but Xamarin on the front end.

05:37 But like I said, it's great.

05:38 There's tons of these things you can just drop in and get cool little widgets and progress bars and buttons and all the kind of things you need to build your UI.

05:46 But what if it could be all Python?

05:48 What if the stuff that you write on the front end or the server-side rendered bits, what if that could also be Python?

05:55 That would be nice, right?

05:56 - Yeah.

05:56 - What I mean is to not write JavaScript in the browser, but instead write Python.

06:02 And you might think, silly, no way.

06:05 But there's this thing called view.py.

06:08 And view.py provides all the bindings for Vue.js, runs on Brython, which is a way to put Python in the browser.

06:16 And there's a bunch of cool example apps that are non-trivial that you can work with.

06:21 So you just write pure Python code.

06:23 If you want to create a Vue.js component, you just derive from the component class in the view.py thing.

06:30 And it's pure Python.

06:31 Wow.

06:31 So that's pretty cool.

06:32 So there's some examples right at the bottom.

06:34 And you can pull those up, and you can run it, and so on.

06:38 So my favorite one is this thing called the SVG graph.

06:43 So they all have a demo, and they have the source, and you can run it.

06:45 And the first time, it takes them maybe a couple seconds to download the Brython JavaScript and whatnot.

06:51 But it's like a super cool little interactive little thing all in Python.

06:56 You can check out the source.

06:57 -Neat.

06:58 Yeah, definitely will.

06:59 That's cool.

06:59 -Yeah.

07:00 So I was a little hesitant to cover Quasar, because it's pure JavaScript, but if I can take view.py and then write this, then now we're talking.

07:10 Now we're getting somewhere interesting.

07:11 Now build on top of that, that the Electron apps don't care about how much download time it takes or whatever, right?

07:19 'Cause you ship it, like one of the things included with a Electron app is Chrome, right?

07:25 Which is like 60 megs or more.

07:28 So who cares if you throw in an extra 200K for like a Brython JavaScript.

07:34 So it could be a really cool way to build some desktop apps with Python and VJS.

07:38 - Yeah, I think that's a neat idea.

07:40 - Cool. - Yeah.

07:41 Anyway, it's kind of a cool mix of front-end JavaScript and some Python, maybe even in the front-end.

07:47 - Yeah. - Yeah, all right.

07:48 What's the next one?

07:49 - 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 giving me resources back, and there's a couple of them that I'm actually really excited about.

08:04 So the first one I want to cover is a website called it's regular expressions 101.

08:09 It's at regex101.com.

08:12 And I kind of wish I had this a long time ago, because I know regular expressions are a little different in different languages.

08:19 In this one, you can select Python or PHP or JavaScript or Go as the one you're working with.

08:25 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, and maybe even some stuff you don't want to match.

08:34 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.

08:41 Then since we also have match groups and multiple matches, it shows you how that works too.

08:47 There's also a little quick reference guide.

08:51 It's actually mostly what you need.

08:53 Like for instance, 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.

09:03 I mean, I remember that star is nothing or all, and plus is one or more, but what about if I want to match like three?

09:10 How do I do that? I always forget that.

09:12 That's there.

09:14 If you have to generate as you're generating them, I think this is a pretty cool tool.

09:18 I'm going to use this more.

09:19 >> I got to say, this is really slick. I love it.

09:22 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?

09:30 So I typed dot plus and it says, oh, the dot plus matches any character except for line terminators.

09:37 The plus matches one and unlimited times.

09:40 And then I wrote a little capture group and it says, oh, the capture group means this and whatnot.

09:45 And yeah.

09:46 Oh, so like, 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.

09:56 Yeah, yeah, it's, I got to say, cool.

10:00 And then if you want to see it running in action in your code, you can hit the generate function and it generates a little script for you that you can just copy and paste into a file and run it to see what it looks like.

10:12 It's pretty nice.

10:13 Yeah, this is a super slick little web app.

10:15 If I was better at regular expressions, I'd be able to do really cool stuff, but I can just kind of write them.

10:22 So it works still.

10:23 It's good.

10:24 And then somebody else mentioned RegExGolf, and it just doesn't teach you at all.

10:30 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.

10:41 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.

10:49 I'm like, how?

10:51 How did you match it with one character?

10:52 Yeah, that's pretty awesome and got some spare time, I guess.

10:58 Well, you know, I'm a manager and also the spare time comes with the territory.

11:03 That's right.

11:04 Now, this regular expression 101 is a super cool web app and I'm definitely going to save it.

11:09 Any time I got to do regular expression stuff, I'm going to go back to it.

11:12 Speaking of regular, tell me about our sponsor today.

11:14 Yes, our regular sponsor, DigitalOcean.

11:17 They've been sponsoring the show for quite a while.

11:19 And they're doing all sorts of cool stuff.

11:21 They got managed Postgres database services.

11:23 Obviously, their main thing is running virtual machines and really quick and easy to do that.

11:28 I was just logged into a bunch of mine there today to upgrade some stuff.

11:33 And they also have now a Kubernetes cluster option.

11:37 So they've managed Kubernetes services.

11:39 It's super easy.

11:40 You go over there in just a few minutes.

11:41 You can have your Kubernetes cluster up and running.

11:44 And they take care of all the stuff you need for that.

11:46 So if you're thinking about doing anything with Docker and scaling it out, check out Kubernetes, of course, and then the Kubernetes service over at DigitalOcean.

11:56 Very, very nice.

11:57 And yeah, they're great supporters of the show.

11:59 A lot of our infrastructure runs on what they're doing.

12:01 So appreciate that and can definitely recommend them.

12:04 Try them at pythonby.fm/digitalocean.

12:06 and get a $50 credit for new users.

12:10 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.

12:22 So you get really fast disk access, right?

12:26 - Yeah.

12:27 - Yeah, well, if you have fast disk access and you can speak properly, you could actually use that as a cache, right?

12:35 So caching has huge benefits for making our apps faster.

12:39 And a lot of the ways that people think about caching is they think about, I'm going to precompute some stuff and cram it into memory.

12:47 And that's OK.

12:47 But so if you go over to, say, DigitalOcean and you fire up a server, the server comes with 1 gig of memory, but 25 or 50 gigs of SSD.

13:00 So if you're trying to squeeze a lot of performance out of your app, you could go buy 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.

13:12 Or you could just use that really fast disk.

13:14 So this next, the fourth item I want to talk about is something called Python-DiskCache.

13:20 I'm not going to give it a huge grade for creative naming, but definitely descriptive.

13:25 Yeah.

13:26 So the idea is that we can basically treat this Python disk cache kind of like Redis.

13:31 Like you put an item, you get an item, but it stores it on disk.

13:36 And it's apparently super fast.

13:38 And it's also pure Python.

13:40 - I don't get it.

13:41 If it came from disk and you're caching it on disk, for data that--

13:45 - It might not have come from disk.

13:46 What if you call like a search API or you--

13:49 - Oh yeah, you're using somebody else.

13:51 - Right, somebody types in, I want to find X on the website and you have to go to like do a big complex database query or an elastic search query.

13:59 - Okay, got it.

14:00 Instead, you could say, this key of search for this goes to bam, those results.

14:04 And now you just deserialize them, like pickle or JSON or whatever.

14:08 And it's just like super, super quick.

14:12 Or even if you're doing computational stuff, like I know if I pass in 20 to this crazy computational method, I get this number back.

14:21 Well, you can cache that.

14:24 And you can cache it in memory.

14:25 That's OK.

14:26 You can use the FuncTools LRU cache, which is pretty cool.

14:30 But even if you have enough space, it doesn't keep working across reruns of your app.

14:36 So you run it once, and it does some stuff.

14:38 But then as soon as it exits, it's gone from memory.

14:40 Then you run it again.

14:41 Well, now it's got to start over.

14:43 But if it's on disk, it's persistent.

14:44 So that's cool, too.

14:45 Django itself has built-in caching, which is cool.

14:49 But apparently, at least according to the author of this--

14:51 I don't do enough Django to know for sure--

14:53 but apparently, the file-based cache in Django is essentially broken.

14:59 if you listen to what he says.

15:01 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.

15:09 You know, it could take like 60 milliseconds to store a key with a couple thousand items in the cache.

15:14 Like that's kind of ridiculous.

15:16 So apparently this thing, this disk cache is much, much faster and it takes micro seconds, not milliseconds, which is pretty awesome.

15:25 And it's a built-in pluggable replacement for the Django cache.

15:30 You can just say Django use this thing as the disk cache.

15:32 - Oh, okay, nice.

15:33 - Yeah, it basically uses memory map files and other database technologies to store stuff on disk, which is pretty cool.

15:42 It's all C, no C, it's all Python, which is great.

15:45 You'd like this, it has 100% test coverage with unit tests and hours of stress tests.

15:50 - Yeah, and pytest.

15:51 - Yeah, and finally, you might say, well, I've heard of other things like this, right?

15:55 Like there's other types of caches like this.

15:59 So there's stuff called DBM and Shelf and SQL Dict and PickleDB.

16:04 And I think these are all new to me.

16:06 But there's a bunch of these other similar types of things.

16:08 But what's cool is they have a really great breakdown of all the features you might care about, like for DBM, is it atomic?

16:17 For Shelf, is it thread safe?

16:19 And so on.

16:19 And so it really shows you a lot of places why you might care about using this in addition to just, oh, here's yet another.

16:26 I like the comparison.

16:28 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.

16:35 - Yeah, you already get indexes for efficient lookups and inserts and stuff like that.

16:39 - Yeah, so, cool.

16:40 - Very cool, so if you have to cache stuff, or you have things that are slow and caching might fix it, this is actually a really interesting way to think about it 'cause the alternative of setting up other servers like Redis and then having to manage the connections and all that, that's great if that's something that works for you and you need it, But this seems really simple.

16:58 - Yeah, and I was thinking along the lines of it, 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.

17:16 And so something that caches the more recent stuff makes a lot of sense.

17:21 - Yeah, and it's quite cool.

17:23 Yep, what's the next one?

17:24 - Oh yeah, it's my turn.

17:25 (laughing)

17:27 - Oh, 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.

17:33 - Yeah, it's like the tutorial is type help this, type help that.

17:36 - Yeah, and so that's what I wanna talk about.

17:38 I wanna talk about the Python help system.

17:41 And I guess I knew it was around, but I kind of forgot.

17:44 So there was an article on StackAbuse about the Python help system.

17:49 And in a Python REPL, you can, like for instance, type help print and then you do, you know, help is a function and you pass it.

17:58 If you pass an object or a built-in something like print and dict or built-ins, you get like a lot of information.

18:05 Like if you type help dict, you get basically a tutorial on what all the stuff you get on dictionaries.

18:12 It's pretty nice.

18:13 And I tried like, and things that are keywords that are not objects, you can type help on those too, but you put them in like quotes first.

18:21 So like you can type help quote assert and get all the information on how assert works in Python.

18:27 And you can import stuff.

18:29 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.

18:37 And yeah, you can learn about a lot.

18:39 Like I just did that to try it and I'm like, oh cool.

18:42 I always forget that log can take a different base.

18:44 So you can do, I don't know, base seven if you were just crazy and wanted to.

18:48 - Yeah.

18:49 - And then for non-built-in stuff and other libraries, even your own stuff, Help will pull out the doc string.

18:55 And I mean, there's-- actually, I forget about this.

18:58 There's a lot of stuff that you could just type Help on that instead of googling or hitting Stack Overflow, you just look it up.

19:04 Yeah, and it's right there.

19:05 And even works with-- it's offline.

19:07 It's great.

19:08 You're right that HelpDict has a ridiculous amount of stuff in there.

19:11 That's pretty crazy.

19:12 I've never typed that.

19:15 Shows you all the magic methods that are overridden and all the stuff that happens.

19:18 Yeah, it's quite cool, actually.

19:20 - Yeah, and the things that you can convert to dictionaries.

19:23 - Yeah, it's a nice one.

19:25 Keeping with the same line of thinking of like, I have some code and I want to understand how it works and how it fits together, right?

19:30 This is like the documentation and some of the methods and examples and stuff.

19:34 But David Seddon sent over a cool couple of projects that he works on that is like a higher level architectural overview of Python libraries.

19:44 So I think these are created by him.

19:46 And one is called Impulse and one is called import linter.

19:50 And the idea is that you get a quick picture of all the dependencies within a Python package.

19:56 - Oh, nice.

19:57 - 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 look all through it and say, well, here's all the modules, sub-modules, classes, and so on that are referencing each other, and it draws a cool architectural graph of this depends on that, which depends on that, and so on.

20:19 Oh, wow.

20:20 Yeah.

20:21 So it's a good idea to just run that against code that you're not super familiar with.

20:25 Before you go digging through the source code, let me just get a picture of what's in here and what's talking to what.

20:30 Yeah, and also, if people keep asking about a particular part of your code base, do this and see how many loops and knots are in it.

20:39 And maybe that's why.

20:41 Yeah, exactly.

20:41 It's a little more complicated than it probably should be.

20:44 Or why does everything depend on this?

20:46 Yeah, it's cool.

20:47 If you want to run it, you might get an error that it can't draw the graph.

20:50 You have to have GraphViz separately installed, because it draws the graph, and then it hands the data off to there to do the drawing.

20:58 And if you're on a Mac, you can just brew install GraphViz.

21:01 You just basically have that installed, and then you can more or less just run ImpulseDrawGraph on things.

21:05 It's great.

21:05 - Nice.

21:06 - Yeah, the other one, ImportLinter, allows you to check contracts about the dependency graph.

21:11 So you can say, like, we want to prevent circular dependencies or other types of constraints, like this should never depend upon that.

21:18 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.

21:26 - Oh, interesting.

21:28 - Yep.

21:29 - Ah, this is cool.

21:30 - 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.

21:37 - Yeah, I mean, if you were teaching a class, and you said I want you to implement something, but don't use package X.

21:44 - That's right.

21:45 have this as a test.

21:46 - Submit your answer here and we'll lint it.

21:48 Yeah, it's cool.

21:49 So if you care about these architectural graphs and whatnot, yeah, these are nice tools.

21:54 You can turn on your Python code.

21:55 - Yeah, nice.

21:56 Well, so that's all of our six.

21:58 You got anything extra for us?

22:00 - I ran across something that I'm sure some folks know about, definitely the core developers know about, but it just made me laugh.

22:07 I was just like, all right, this is funny.

22:10 So I was working on some package and I needed to understand it better, So I just used PyCharm, go to definition, and took me inside the source code of some part of the standard library.

22:20 And I saw it was importing TabNanny.

22:23 I'm like, what the heck?

22:25 TabNanny.

22:26 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.

22:39 And I knew Python checked it.

22:40 I just didn't know that the thing that did that checking was called TabNanny.

22:44 So I thought that was funny.

22:45 I thought I'd share that with you all.

22:46 - That's awesome.

22:47 (laughing)

22:49 And there's a thing called bad tabs.

22:51 (laughing)

22:53 - Yeah, it's pretty funny.

22:55 - Yeah, nice.

22:56 - 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.

23:03 It seems like everyone's enjoying that.

23:05 So if you want to work with Flask, that's also a good one.

23:08 - Okay. - Anything for you, Brian?

23:09 - Nope, just working away.

23:10 The new office is working pretty good, but I've decided like it last week, it was sitting on the ground.

23:16 I've got a chair this week, so this is good.

23:19 - You're upgrading your podcasting studio from the office, I see.

23:22 - I'm elevating my environment, yeah.

23:25 - Nice. - Literally.

23:26 - All right, we have two jokes for you all this time.

23:28 You want me to kick this one off?

23:29 - Yeah. - All right.

23:30 This is a joke that never gets boring, okay?

23:32 You can tell it as many times as you want.

23:34 It's never the same.

23:35 All right, so two threads walk into a bar.

23:37 The bartender looks up and yells, "Hey, I don't any conditions race like time last." (laughing)

23:46 - Yeah, yeah.

23:47 - The next time you tell it, you could be like, "Hey, two threads walking in bar, "barkeeper looks up and yells, "don't any conditions I, hey, want race like time last." Right, just, it's good every time.

23:58 - Yeah, it's good every time.

23:59 - All right, how about you?

24:00 - A string value walks into a bar and then was sent to standard out.

24:04 (laughing)

24:04 That's a pipe joke. - I love it.

24:06 Pipe joke, that's great.

24:07 - Always good to finish on a laugh.

24:09 Brian, thanks for being here and doing all this research for everyone.

24:13 - Yeah, thank you.

24:14 - Yep, you bet.

24:14 See ya.

24:15 Thank you for listening to Python Bytes.

24:17 Follow the show on Twitter via @PythonBytes.

24:19 That's Python Bytes as in B-Y-T-E-S.

24:22 And get the full show notes at PythonBytes.fm.

24:26 If you have a news item you want featured, just visit PythonBytes.fm and send it our way.

24:30 We're always on the lookout for sharing something cool.

24:32 On behalf of myself and Brian Auchin, this is Michael Kennedy.

24:36 Thank you for listening and sharing this podcast with your friends and colleagues.

Back to show page