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


Transcript #223: Beware: A ninja is shadowing Sebastian from FastAPI

Return to episode page view on github
Recorded on Wednesday, Mar 3, 2021.

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

00:05 This is episode 223, recorded March 3rd, 2021.

00:10 I'm Brian Okken.

00:11 I'm Michael Kennedy.

00:12 And I'm Sebastian Ramirez.

00:14 Cool, we did that without talking over the top.

00:16 Hey, we're getting good at this.

00:18 Welcome, Sebastian. Great to see you.

00:20 Thank you very much for inviting me. It's a pleasure to be here with you.

00:23 All right. Well, let's start it off.

00:26 Oh, I wanted to mention, we'll talk about them later, but thanks to Datadog for sponsoring this episode.

00:31 Yeah, yeah. And Sebastian, people maybe know you, but they definitely know your API framework, right?

00:37 I hope so. At least some of them.

00:39 Yeah, should I say who I am or not yet?

00:44 Yeah, yeah, sure. Give us a quick little introduction and we'll jump over to the items.

00:47 Awesome. So hello, everyone. I'm Sebastian Ramirez.

00:49 I'm the creator of FastAPI, which is a web API framework for Python.

00:56 Based on type annotations that, yeah, well, it has been used by quite a bunch of interesting organizations and products recently.

01:05 I'm a software developer at Explosion in Berlin, Germany, but I'm actually from Colombia.

01:10 That's why I said it.

01:11 And yeah, that's a lovely.

01:12 Fantastic. Yeah. And you have the best mustache of anyone that's ever been on the show.

01:16 Thank you very much.

01:18 Definitely. Well, let's jump in.

01:20 So I wanted to cover the Python developer survey 2020 results.

01:26 This is pretty exciting.

01:28 We'll get a little bit in a minute to talk about one of the things I wanted to talk about, of course.

01:34 But let's look at it a little bit.

01:35 So the Python developer survey is put on by the PSF, right?

01:41 Isn't it joint PSF and JetBrains?

01:43 Yeah, I think it's put on by the PSF.

01:46 It's like hosted and analyzed by JetBrains, but it's not collected by JetBrains.

01:51 They make a point of not, you know, it's put on python.org and maybe even PyPI, but not on jetbrains.com.

01:58 So they try to not slant it in that regard.

02:01 Yeah.

02:01 So, but yeah, it's hard to, yeah.

02:04 Anyway, there's a whole bunch of cool stuff in here.

02:06 One of the things that takeaways that I was confused by a little bit at first was the use, what do you use Python for?

02:13 And you've got a lot of reductions in percentages, but if you look at what increased, so you kind of see that people are using Python for more stuff and it's spreading out.

02:23 So there's increases in education and in desktop apps.

02:27 Games increased quite a bit.

02:29 Mobile, which was interesting, and other.

02:32 So the long tail has gotten fatter and that's good.

02:36 We're using Python for a lot of stuff.

02:37 Another good sign is Python 3 is increased.

02:41 So last year we had 90% usage of Python 3.

02:44 Now it's up to 94%.

02:46 Not sure why it's not at 100% yet, but I think there's some, probably some legacy stuff.

02:51 There's some projects out there that are in the, please don't touch it, it's working.

02:56 Nobody knows how it works, just leave it alone category.

03:00 And it's probably that last 5% or so.

03:03 Yeah.

03:03 What are people using for environment isolation?

03:07 We've got virtual MV at 54%, but I assume that also includes VENV or the built-in.

03:15 There's like two.

03:16 Yeah, I saw there was no mention of VENV.

03:18 So just virtual ENV probably is that as well.

03:21 I had that same question.

03:22 I'm like, wait, surely somebody uses Python-VenV because I answered that question.

03:30 Yeah, we kind of use those interchangeably.

03:32 So I guess that maybe that's what it is.

03:34 But one of the things that surprised me was that the, I've heard, I know a lot of people

03:39 use Conda for data science stuff.

03:41 That's at 22%.

03:42 But 32% are just using Docker for isolation, which that surprised me.

03:47 That's an interesting thing.

03:48 That's a hardcore isolation.

03:50 Yeah.

03:50 Yeah.

03:52 Although I think more and more people are just using it all the time for a lot of stuff.

03:56 So I guess why not?

03:57 Sebastian, what about you?

03:58 Are you a poetry?

03:59 Are you a Python-MVNV?

04:00 Are you a Docker?

04:02 I'm all over the place.

04:04 Actually, I'm quite a fan of poetry.

04:05 And I think it's a great tool because it puts a lot of functionality in the same place.

04:13 Handling dependencies, handling environments, and handling pinning versions.

04:18 When you add a new package with poetry, it automatically detects what is the latest version and has the

04:23 right ranges of versions.

04:25 So I think that's very, very cool.

04:27 And creating a package with poetry is super straightforward to create a package that can

04:32 be later published directly.

04:34 So it's more similar to NPM in the Node.js world.

04:38 Right.

04:39 Because you can publish from it as well, right?

04:41 You can create the package and then publish.

04:42 Yeah.

04:43 And have all the configurations together.

04:44 But at the same time, I'm using vanilla Python VM in a bunch of projects at work and

04:50 things and a bunch of Docker as well.

04:52 So yeah, it's many different things.

04:55 I would think that for local development, it's always one type of virtual environment, being

05:02 a VM for poetry.

05:03 And then for deployment, sometimes it's just like pure Docker, sometimes poetry inside of

05:09 Docker, but not even using the virtual environment.

05:11 But yeah, I would think Docker for deployment and then locally virtual environments, at least

05:16 for me.

05:17 Yeah.

05:17 And that was the majority.

05:18 I think most people are primarily using VNV for that, but I can't remember exactly.

05:23 Hey, Brian, quick comment.

05:24 Yeah.

05:24 What's that?

05:25 Is VNV versus virtual ENV a Python 2 versus 3 thing?

05:29 Oh, yeah.

05:30 I guess maybe it is.

05:31 I think, you know, VNV was added, I believe, in Python 3.

05:35 But, and I had kind of forgotten about virtual ENV, but there's some interesting stuff.

05:39 I think we covered it a while ago, the release of version 20, because it actually does a lot

05:44 of interesting stuff.

05:45 And then Magnuson has a comment on poetry.

05:50 manually in order to use --prompt, which is, so it's not called VNV when your prompt

05:57 changes, but project name in parentheses when your project changes, which is the question

06:02 Gandalf had.

06:02 And then Dean is a fan of the virtual ENV wrapper as well.

06:07 So awesome.

06:08 Yeah, I haven't either.

06:10 I feel like this is one of the areas where there's just so many different ways people

06:14 are doing this stuff.

06:15 But yeah, with our special guest here, Brian, but how about you touch on this one?

06:20 This is big news here.

06:21 Yeah.

06:22 So this is big news.

06:23 So frameworks and libraries under web frameworks, we've got Flask at 46%, Django at 43%.

06:29 And then, dun, dun, dun, FastAPI at 12%.

06:33 It's the first time it was on the survey, and it's already up at number three.

06:37 So yeah, way to go.

06:39 The growth is super, super interesting there.

06:42 And yeah, congratulations, Sebastian.

06:43 And I actually think that this is going to grow quite a bit more.

06:47 If you look at the first derivative, it's higher for the numbers for FastAPI, like the

06:53 rate of growth or just the growth.

06:55 Also, I feel like a lot of people are not necessarily leveraging.

07:00 I mean, I'd like to hear your thoughts on this, Sebastian.

07:02 Leveraging FastAPI's ability to deliver HTML as well.

07:06 Yeah, absolutely.

07:08 Because if you're rendering HTML in the backend, the benefits of FastAPI are not as obvious.

07:15 So I guess people probably will use it more for APIs.

07:21 But then there's actually a bunch of people using it for very different stuff than what

07:27 I initially thought of.

07:29 Yeah, yeah.

07:29 Yeah, I think, you know, I think you can basically get down to the Starlette type features and stuff.

07:33 And then you can build, you know, an equivalent of Flask or Django.

07:37 And what I think is interesting about that is a lot of people are like, well, I could do this

07:40 really cool API with FastAPI.

07:42 And then do we use Flask or Django for the web part?

07:44 It's like, well, if you've already got the FastAPI part and you've got like 10 pages

07:48 you want to serve, just, you know, don't juggle two apps.

07:51 Just like put them there.

07:52 It's actually not that hard.

07:53 So I think there's some really interesting stuff.

07:55 And I think as people learn those and leverage those, it's only going to grow because they're

07:59 like, oh, I actually don't have to have Flask plus FastAPI.

08:02 I could just have FastAPI.

08:03 Yeah.

08:03 Not the Flask is bad, but yeah.

08:05 Yeah.

08:05 Of course.

08:06 And like FastAPI is actually, FastAPI owes and was inspired a lot by all of these frameworks

08:13 that paved the way.

08:14 Like all of these designs of these ideas came before FastAPI.

08:18 FastAPI is just putting them together with the new type annotations from modern Python.

08:23 But yeah, like it's all the work that has been done by a lot of people.

08:28 Yeah.

08:28 Yeah.

08:28 Yeah.

08:29 Standing on the shoulders of giants type thing.

08:31 Exactly.

08:31 Exactly.

08:32 Yeah.

08:32 Yeah.

08:32 Awesome.

08:33 But yeah.

08:33 I've got some stuff to add to that as well for my next item, by the way.

08:37 Oh, cool.

08:37 Yeah.

08:38 No, before we move on, one of the things in the survey that was interesting to me was the

08:43 use of continuous integration.

08:46 So I use CI or continuous integration all the time, but one of the, see if I can find it.

08:53 CI, the CI systems in use, GitLab was top, which was interesting to me.

08:59 I mean, I use GitLab at work, but I use GitHub or I use, I guess, GitLab CI, but I'm using

09:05 GitHub Actions a lot and I don't see GitHub Actions even here.

09:08 So I wonder if it just wasn't listed or I'm not sure.

09:11 That's quite interesting.

09:12 Yeah.

09:12 I haven't noticed that GitHub Actions is not.

09:14 Yeah.

09:15 I expected to see it as well.

09:16 Yeah.

09:17 Yeah.

09:17 But what I did not see, I just want to throw this out, like, well done on building the

09:20 survey because what I didn't see is what platform are you on?

09:23 Do you use Python or do you use SQL or do you use Vue.js?

09:27 Like, they did a good job of comparing apples to apples in this one.

09:32 And that was nice.

09:33 Yeah.

09:34 Yeah.

09:34 Yeah.

09:35 I guess, but like, I guess what you brought up before on the web frameworks though, the,

09:40 like why, I mean, it depends on what you're using the web for.

09:45 So like you, the early use of FastAPI was just APIs.

09:49 So I don't know.

09:51 That's not apples to apples.

09:52 Right.

09:52 You may be doing Flask plus FastAPI.

09:54 Yeah.

09:55 Yeah.

09:55 And that, the survey allows that you can, if you add these numbers up, they are over a

10:01 hundred.

10:01 So I wanted to bring up one more thing.

10:04 I guess unit testing is at 49% for pytest.

10:07 So pytest is in the lead.

10:08 Yeah.

10:09 I also saw there's a really interesting number two in that list there.

10:13 28% of using unit test.

10:15 Yeah.

10:16 No, that's not the one I was thinking of.

10:17 That's number three.

10:18 Oh, was it number three?

10:19 Number two is none.

10:20 Number two.

10:20 Number two is, so, you know, in Python, when like a lot of languages have null or nil, but

10:26 apparently people just like do stuff with the none type to test here a lot.

10:31 So.

10:31 None testing.

10:35 Yeah.

10:35 Oh yeah.

10:36 That is number two.

10:37 Yeah.

10:37 It's crushing it.

10:38 Yeah.

10:38 None is pretty.

10:39 I mean, you do get a lot of exceptions and it's easy to like fail first and then, yeah.

10:43 Anyway.

10:43 So I got to talk to.

10:44 Nil type has no attributes such and such.

10:46 I got to talk to the PSF and JetBrains about this because I'm not sure why they call it unit

10:52 testing frameworks.

10:53 We got to get, we got to drop the unit off there.

10:55 Just call them testing frameworks.

10:57 Yeah.

10:57 Brian, I hope you don't mind.

10:58 I'm considering writing a book on this new none framework, by the way.

11:01 I just.

11:02 I think you should.

11:04 That would be funny.

11:06 Actually, I actually, yeah, it's really short.

11:10 It's really, really short.

11:11 All right.

11:13 Probably one page book.

11:15 Okay.

11:15 All right.

11:16 Next item.

11:17 I got to keep moving along or we're going to have a two hour show here is I like ninjas.

11:21 Do you like ninjas guys?

11:22 Ninjas are cool.

11:23 Oh yeah.

11:23 Well, I mean, I don't know any, but.

11:25 Well, I mean, if you are a ninja, you can't really speak about it because it's something

11:29 about this secrecy.

11:30 And anyway, Sebastian was just talking about how FastAPI was inspired by many of the frameworks

11:35 that were on there.

11:36 And there's a cool framework called Django ninja, fast Django rest framework.

11:41 And I'm not a super expert in Django, but I think Django rest framework has been primarily

11:46 the way to do APIs in Django these days and to layer that on.

11:49 And if you look at the very bottom of this, there's a little bit here that says this project

11:54 was heavily inspired by FastAPI developed by some guy named Sebastian.

11:58 So that's pretty cool.

11:59 Have you checked this out, Sebastian?

12:00 I have seen it.

12:01 And actually the author was quite active in the FastAPI community.

12:05 And like, yeah, like I haven't been able to play around with the framework itself.

12:10 But yeah, like I think it could be a very nice idea, a very nice middle ground for people

12:16 that is already having a lot of work, already a lot of code with Django rest framework.

12:21 Yeah, exactly.

12:22 Exactly.

12:23 So this was sent over by Marcus Sharp and Adam Parkin, who goes by Codependent Coder independently.

12:29 So thank you both for sending this in.

12:31 And the idea is that it's a framework for building APIs primarily based on type hints, but also

12:37 with async support.

12:38 And it makes use of Pydantic.

12:40 And those are many of the important ingredients that make FastAPI special as well.

12:44 So some of the key features are it's pretty easy to work with.

12:47 It has a similar feel as FastAPI.

12:51 It's high performance, partly because of Pydantic, partly because it has native async support

12:56 and partly just because they did a good job there.

12:58 Also fast to code.

12:59 The type hints let you know what you're working with and automatically get conversions along

13:05 with Pydantic, of course, does massive levels of like validation and conversion.

13:09 And then it also has automatic docs with open API, formerly known as Swagger, similar to

13:15 FastAPI in that regard.

13:16 And the reason this is interesting, I think, is because it's Django friendly.

13:20 So it has integration with Django core.

13:22 It has integration with Django RRM.

13:24 So if you're already got all of your stuff done in Django and you were thinking, well,

13:29 I really want to have these this style of API that FastAPI brings, but I don't want to

13:33 leave Django.

13:34 I don't want to have to rewrite everything in SQLAlchemy and learn the async API over there

13:39 and that kind of stuff.

13:40 Well, here's a way to kind of like layer on APIs to your Django app, but in the zen of

13:45 what Sebastian.

13:46 So, yeah, I think it's pretty cool.

13:47 And if you check out the performance here, you can see it's slightly faster in the single

13:54 threaded version.

13:55 But once you bust out async and await and it starts just crushing it.

13:59 So here you can see like with 50 operations, 50 workers and so on.

14:02 And what's really interesting is you see like this graph at the bottom of as you add more

14:06 workers, things like Django RRM framework or Flask Marshmallow start to catch up.

14:10 And my theory, looking at this graph, my intuition is what this means is the thing that it's talking

14:16 to and the backend, like the database that it was talking to or something like that is starting to

14:22 like not be able to take it anymore.

14:24 Or the overall CPU level is just starting to like to hit a limit where it can't scale.

14:30 Because it's really interesting that it's kind of just like linear number of things for or flat for

14:35 the Django Ninja.

14:35 And as the scale increases, it kind of gets it's normalized on that.

14:40 So it would be flat.

14:41 But anyway, it's a pretty interesting graph, I think there.

14:43 Yeah, and then last thing, just a super quick example of here is all you got to do is create

14:49 a ninja, API ninja, and then you do an API.get, give it a URL, you give it some parameters.

14:54 Those parameters have types like a colon int, b colon int, and then you return a dictionary

14:59 and off you go.

15:00 And then you've got an API and presumably you could make this async def add, although there's

15:06 really no reason to do it.

15:07 You could, right?

15:09 Because it supports async.

15:09 Anyway, I think there's a pretty cool thing for people already doing Django.

15:13 And they're like, we have so much logic in the ORM and in the other parts of our app.

15:17 We just want to add in this style of API.

15:20 I think this is neat.

15:21 Absolutely.

15:21 Yeah.

15:22 Cool, cool.

15:23 All right.

15:23 Well, let's see.

15:24 What's your first item, Sebastian?

15:26 So I have Pydantic 1.8 was released.

15:31 It was released one or two weeks ago.

15:33 It's the latest version.

15:35 And it has a bunch of interesting things.

15:37 It has a hypothesis plugin for doing property-based testing, which I haven't been able to try out

15:45 yet a lot.

15:47 But I have heard a lot of good things about this idea of property-based testing.

15:53 And in fact, there's a package for doing this type of testing, integrating hypotheses with

16:00 OpenAPI.

16:01 So you can test, like it was made to test FastAPI actually with these ideas.

16:05 But then now there's an integrated plugin in Pydantic.

16:09 So I think that can be quite interesting.

16:11 And also there's now support in Pydantic directly for name tuples and for type dicts.

16:18 So type dicts are these new types or type declarations to say what is the shape of a dictionary inside

16:26 of Python.

16:27 If you have played with TypeScript, it will be comparable to an interface or I guess, you

16:32 know, languages too.

16:33 But then these type dicts, the thing is that they are the official or standard way inside

16:41 of Python that are part of Python to define the types of dictionaries.

16:46 Because Pydantic is actually a class.

16:48 So this could be, I think these type dicts will be interesting, for example, for declaring

16:54 the parameters of a function that are actually a dictionary and declaring where the types that

17:00 that dictionary should take, things like that.

17:02 And I will expect editors to be able to have support for that.

17:06 So imagine that you are passing a parameter to a dictionary and the, sorry, a parameter

17:11 to a function and the parameter is a dictionary and then the editor can give you completion

17:15 or the dictionary inside of the parameter that you're passing or the argument that you're

17:21 passing to the function.

17:21 Things like that.

17:22 I think type dicts will help a lot.

17:24 And then now you can use them inside of Pydantic models.

17:27 And I think that's pretty cool.

17:28 And this other one is the, the, the, the Pydantic has support for annotated types, which is another

17:34 of these types.

17:35 So annotated is one of these things that you import from typing the same way that you will

17:42 import a optional or that you will import a union or that you will import the type for

17:47 lists.

17:49 This is cool.

17:49 I was wondering how you would do stuff like this.

17:52 If you could say add a default value to a Pydantic model or to add a simple constraints.

17:58 Yeah.

17:58 So the thing is that with, with, with Pydantic and with FastAPI, you have a way to declare

18:04 like before annotated exist that you have a way to declare those things by setting the default

18:09 value as a call to Pydantic field, which is a special function.

18:15 Or if as API, you could call, for example, a, a, a, a, the function query, which is a special

18:21 function that returns a special object that has all the information, including metadata for

18:26 validation and maybe like the title or the description of their specific parameter, things like that.

18:31 But then the, the issue with that approach is that we are taking the place in the, in the declaration

18:38 of the parameter inside of the function.

18:40 We are taking the place that will be used by the default value.

18:43 And we are like playing around with that default value inside of the function signature, inside

18:51 of the function declaration of parameters.

18:52 So it's actually not like the most correct way to do it.

18:56 It's, it's, it's, it's kind of intuitive and it works quite well with Pydantic and FastAPI.

19:00 Okay.

19:01 But in terms of types, it's not very, very explicit.

19:05 And now with this new annotated type, you can put the actual type that the parameter has,

19:12 like let's say it's a string.

19:14 And then you can also put the extra metadata that will go for Pydantic or for FastAPI inside

19:21 of the same annotated, a generic type is the name.

19:25 So the same way that you will put, let's say, annotate a type that is additional, that has

19:31 strings as keys, and then as values, it has integers.

19:35 Then instead of that, you will put this annotated thing and declare the type of the parameter

19:41 and this extra metadata that's going to include like validation and a bunch of things.

19:44 And then the default value can be kept for the actual default value of the parameter.

19:50 So that could be very useful, especially if you are calling the same functions, for example,

19:56 for FastAPI dependencies and you're calling the same functions in other places.

20:00 And I think that, that, that can be very powerful and very, very useful for reusing coding even

20:06 more places.

20:06 Yeah.

20:07 When I first looked at this, I thought it was this annotated thing was the value you were

20:11 setting like SQLAlchemy would be, or Django ORM or something where you say like name equals

20:16 an annotated thing, but that's actually the type it's named colon.

20:20 This really interesting annotated thing with lots of constraints equals some potential default

20:25 value or equals nothing.

20:26 Right.

20:26 You just don't even have to set a value.

20:27 Yeah.

20:28 Yeah.

20:28 And like, I don't know.

20:30 I feel the syntax might look a little bit weird.

20:33 It's not necessarily like the most intuitive, but it's like the most correct at the same time.

20:40 So in, in cases where like the strict type correctness is important, I think this is,

20:46 this could be quite useful.

20:48 Yeah.

20:48 So another thing that I, this is not in the new release, but I'd like to hear your thoughts

20:53 on it.

20:53 I, what is it called?

20:54 Validation.

20:55 Is that what it's?

20:56 There's a type with like runtime validation.

20:59 I think this, this thing here is you say at validate arguments.

21:03 Have you seen this for actually going, you know, instead of just suggesting that it's

21:08 a string and an integer, it will actually make sure that it's a string and an integer at runtime.

21:13 Have you played with this?

21:14 What are your thoughts?

21:14 I haven't played with it.

21:16 Like I remember when someone was talking about it and it was super exciting because it's also

21:21 the very, it's the same idea of what, what FastAPI is doing or similarly what type, which

21:28 is like the equivalent of FastAPI for building command line applications, the equivalent of

21:33 what they do, which is take a signature in the, take the parameters from the function and use

21:39 those parameters to do validation.

21:42 I think that's very interesting and very powerful.

21:44 I just haven't used it yet because I use Pydantic most of the time with FastAPI and in fast

21:51 API, there's no need to, to add the specific decorator because FastAPI is already doing

21:56 that.

21:56 But for other use cases where, where it's not really using FastAPI, but just Pydantic standalone

22:02 because Pydantic is awesome by itself.

22:04 I think this will be very, very powerful.

22:06 Yeah.

22:07 Yeah.

22:07 Totally agree.

22:08 Okay, cool.

22:08 Anything else you want to add on this before we move on?

22:10 Kick it back to Brian.

22:11 No, I think that, that, that was the highlight I had because I think it's pretty cool.

22:17 Well, we brushed by this quickly, but I was curious, not about this, but you mentioned

22:21 a FastAPI does validation.

22:23 I just, we went by that quickly, but is that true?

22:26 Can you, for FastAPI, can I say that this, this data or this, you know, data point that's

22:31 coming in has to be in a certain range of integers or something like that?

22:35 Absolutely.

22:36 Like all the validations that you do, that you can do with Pydantic, you can do them with

22:41 FastAPI.

22:41 And it's like actually like quite extensive, the things that you can do.

22:45 You can say that you want to validate against a regular expression or that you want to have

22:50 a minimum number and a maximum number, or that you want to have, like, I don't know, you could

22:55 even write like custom types of validations for the things that you receive.

23:00 And because Pydantic is based on the same standard Python type annotations, you could do these

23:04 validations even for deeply nested data structures.

23:07 So you can say like, my request of this endpoint is going to receive a list that contains dictionaries

23:16 that inside contain this key tag that contains the strings and this other one that has sub-dictionaries

23:22 and sub-lists and, you know, like a very complex, deeply nested tree of data.

23:27 That's awesome.

23:28 And you can declare all that and have all that validated so that--

23:31 That's awesome.

23:32 --when your code executes, when the code that you wrote executes, it's a FastAPI already took care of

23:39 making sure that the data that you declare is the data that you received.

23:42 Your code will never execute with invalid data.

23:45 That's the idea.

23:46 Yeah.

23:46 Yeah.

23:47 It's so nice in that regard.

23:48 You just like, by the time it gets here, I know it's all been converted and validated

23:53 at least as much as the model is going to validate it for me.

23:55 You don't have to worry about that.

23:57 So it's great to push that to somewhere else.

23:59 Yeah.

23:59 And on the other side, which is also a great feature of Pydantic, the validation shows the

24:07 errors exactly in the place where they are.

24:10 And when you get that, it's like, yes, I can see exactly where is my data wrong.

24:15 So you can see which index in the list was incorrect.

24:19 And inside of that index, which key was incorrect.

24:21 And inside of that, what was the exact error?

24:24 And see like, oh, I had to put a string in another object here, not a JSON object.

24:28 Right.

24:28 And what you mean is like, if I have a Pydantic model and it says it has a list of customers

24:34 and there's three customers in the list, but the third customer that was submitted as part

24:38 of the JSON body has an error.

24:40 It'll say in the customers in index three on this field is the problem.

24:45 Not just the name is required.

24:46 Like, oh, great.

24:47 What does this mean?

24:48 Right.

24:49 Exactly.

24:50 I don't know.

24:51 I don't know how you do to make these examples audible and understandable at the same time.

24:57 It's a difficult.

24:58 That's such a skill.

25:00 Yeah.

25:02 We've been doing it for 223 episodes, I guess.

25:04 Nice.

25:06 All right.

25:07 Brian.

25:08 Yeah.

25:08 So something else that's awesome is Datadog.

25:10 So this episode of Python Bytes is brought to you by Datadog.

25:14 Are you having trouble visualizing latency, CPU, and memory bottlenecks in your app and not sure

25:20 where the issue is coming from or how to solve it?

25:22 Well, Datadog seamlessly correlates logs and traces at the level of individual requests,

25:27 allowing you to quickly troubleshoot your Python application.

25:31 Plus, their continuous profiler allows you to find the most resource-consuming parts in your

25:35 production code all the time at scale, at any scale, with minimal overhead.

25:40 Be the hero that got the app back on track at your company.

25:43 Get started today with a free trial at pythonbytes.fm/datadog or just click the link in your podcast

25:49 player show notes.

25:50 Yes.

25:50 Check out our show notes.

25:52 And thank you, Datadog.

25:53 Yeah.

25:54 Thanks, Datadog.

25:54 And get a cool little Datadog t-shirt as well.

25:57 Speaking of cool, let me talk about the next item here.

26:00 I guess I'm next up on the list here.

26:02 So this item comes to us partially from Will Shanks.

26:06 He sent me the Python side, but I wanted to highlight this sort of broader thing because

26:10 I think it's pretty interesting.

26:12 The first part, let me just tell you the title of the article, the piece of news is,

26:15 Google and Microsoft back Python and Rust programming languages.

26:19 And they both, I believe, do stuff with each, but it's primarily Google backs Python, Microsoft

26:25 backs Rust.

26:26 But the overall trend is part of the story that I think is interesting.

26:30 So they both come along to make significant contributions to the various languages.

26:36 And part of the trade off, I believe there is that they'll have some say or some ability

26:42 to influence where the direction of these projects are going.

26:45 Like, Hey, for example, Google donated $350,000 or it's not quite the right way to put it.

26:51 That's what the article says.

26:52 Google sponsored the PSF at the visionary sponsor level, which has a price tag of $350,000.

26:59 And the goal is, this is the first company to do so, by the way.

27:03 And so they're investing in improved PyPI malware detection and better foundational tools and services

27:10 like pip type of things and so on.

27:13 And they're hiring a CPython developer in residence for 2021.

27:17 I don't know if that position is still open or if there's applications, but anyway, I think that's

27:21 pretty awesome.

27:22 Yeah.

27:22 So yeah, I'm really happy for this.

27:25 That's great.

27:25 I do feel like there's a hundred other companies that should be doing the same thing.

27:30 You know, Bank of America.

27:31 Hello.

27:32 5,000 people working on a Python project there.

27:35 5,000 Python developers.

27:37 Surely some of their wellbeing depends on the wellbeing of Python.

27:40 And, and you'll bank some places like that have at least $300,000 to suspend this

27:44 been on it per year.

27:45 I'm pretty sure.

27:46 You know what I find funny about that, that, you know, like these huge companies, these huge

27:53 corporations, they are depending on Python and all this stuff.

27:56 And they, they, for example, they are for sure running Python and CI and pip install a bunch

28:02 of things.

28:03 And they are probably having some issues with the new resolver and pip install and taking

28:08 a bunch of time and like having a lot of time by their developers waiting for the resolver

28:13 to handle things.

28:14 And the resolver is having to download all the packages that, that match some range

28:21 to be able to extract the metadata, to be able to compute and to be able to do all the backtracking,

28:26 all the stuff.

28:27 And if the PSF was better funded, they, they already have the feature request and they already have the, the idea and the, the, the, the objective to include the metadata of those packages in by PI.

28:42 So that people ask the API, where are the versions instead of downloading all the packages.

28:47 Yeah.

28:47 So it's like things that.

28:49 That seems more efficient, like a, a hundred kilobyte, a hundred byte JSON document instead of megs of packages.

28:55 Exactly.

28:56 And, and it's just like, you know, like it will probably just be like a little funding, just, I don't know, a couple of full-time developers working a lot more on that than, than, than a lot of, volunteering.

29:09 I'm like with, with, yeah.

29:11 Like I feel if, it was better from that they will, they will save a ton of money and time spent by their developers.

29:20 If they, if they, if they, the whole PSF was better from it.

29:24 Absolutely.

29:24 I mean, that's just one small example, right?

29:27 Yeah.

29:27 Yeah.

29:28 Yeah.

29:28 Another one is maybe, maybe we want higher performance.

29:30 Like the, the survey that Brian covered was one of the top requested features was better performance.

29:36 Well, if we had, you know, 20 companies each donate a million dollars, I bet we could get a pretty awesome jit.

29:41 Build or something like that.

29:43 Right.

29:44 I mean, there's, there's like clear links back, to the wellbeing.

29:48 So anyway, awesome Google and Microsoft as well for the rest side of things.

29:53 Absolutely.

29:53 But it's, it's the, I think part of the story is that this is a story, you know, like that this is big news.

30:00 It's awesome, but it should be like, oh yeah.

30:02 And the other 20 or the other a hundred companies.

30:05 Right.

30:05 Yeah.

30:06 So the people that listen to, I mean, Microsoft and, Google know that they, that they,

30:11 use Python and rust.

30:12 But I think there's a lot of people listening to this podcast that know there's a need there, but they're, they're just engineers.

30:19 And there's the people at the top of the company really might not know how much their company depends on these languages.

30:25 Yeah.

30:26 And so I actually, nice.

30:29 I actually would like to, I'd like to have some sort of, how to start that conversation document.

30:35 Something like if I'm, if I'm at a company, how do I start that conversation with my lead leaders to say, how, you know, how do I talk to that to say, Hey, we use Python a lot.

30:47 Can we contribute to the PSO?

30:49 Yeah.

30:49 Yeah.

30:49 I spoke to, I think it was Peter Yang about this.

30:53 no, sorry.

30:54 Peter wing from, Anaconda.

30:56 And he has such a good insight and ideas on, on this whole topic.

31:00 one of the challenges is I think it was, he, him who said this, like they don't have, there's not a place on a, you know, a profits and loss accounting system for charity.

31:11 There's a place for sponsorship where you get something back.

31:15 There's a place for advertising.

31:16 There's a place for it, but just charity alone doesn't quite work.

31:20 So I don't know.

31:21 I think that's part of the story is like kind of got to fit into that world where like, well, we could support it.

31:26 And in this sense that we've been talking about, yeah, you'll get something back, but we need a tangible, we get something back.

31:31 I don't know what that is, but I think there's a little bit of a mismatch there.

31:34 Anyway, just a couple of shout outs to some more.

31:36 We got Salesforce.

31:37 We got Fastly, Bloomberg, Azure, Microsoft, Capital One.

31:41 You'll even find TalkBite on training down near the bottom of that list, sponsoring the PSF over there.

31:46 So that's cool.

31:47 But also just to round this out, Microsoft is doing interesting stuff with Rust around, using it to basically replace where they're using it.

31:56 C and low level stuff like that.

31:58 So, they've joined, Mozilla, AWS, Huawei, and Google as founding members of the Rust Foundation as well.

32:05 And I think they donated something.

32:06 Yeah, no, I, I, I don't know the numbers there, what that means.

32:09 But anyway, thanks, Will Shanks, for sending that over.

32:11 And, thank you, Google and Microsoft and other companies we gave a shout out to for supporting these projects and communities.

32:17 Semantic versions.

32:18 Let's talk about that.

32:19 Yeah, so, yeah, so I, I actually don't know if FastAPI is using Semver or Calver.

32:25 Sebastian, what do you got?

32:27 I think FastAPI will match in what he describes as the YOLO zone in that article.

32:36 Okay.

32:38 So what version are you on?

32:39 So it's 0.something.

32:41 The thing is that I'm managing it as if it was like very strict, same version where I'm, where I'm handling the, the, the bumps in the, in the, in the versions.

32:52 But all, it's all, 0.something still.

32:55 Because I want to add some features and do some, the freedom to do some changes, to the, to the API to have like the best design possible.

33:04 Also because I want to, to release the one version after Ubicor and Starlette have the one version.

33:11 Yeah.

33:12 I think, I think it's what he describes as that.

33:15 So, yeah, so what we're talking about is an article, from, Hinnick saying, semantic versioning will not save you.

33:22 So the, the idea with semantic with, versions is you've, is you've got like a three digit number.

33:28 and you know, and there's a major, minor, micro.

33:32 And the, the, the idea is if, if the, as long as the major number doesn't change and you're using this, this package or this library or this tool, it's, it's not going to break you if it goes up.

33:44 So if you, if you go from 1.9 to 1.10, you can upgrade.

33:48 It's fine.

33:49 and nothing will break, but there's a, there's a whole bunch of problems with that.

33:54 for one, well, it's that, that implication is just, it's not really true all the time.

34:01 I mean, you don't really know it's, it's often, there's no new features, but there'll be something fixes.

34:05 There'll be fixes and things.

34:07 And you might actually depend on the broken behaviors.

34:09 So there's, in practice, you can't really just upgrade willy nilly.

34:14 So in practice, you have to be like, if you're depending on a package and it changes its version, you have to, you have to test and have good coverage for your own code to start with.

34:24 And you should pin your dependencies.

34:25 So you don't just automatically update to the newest one, but you should also try to regularly keep updated to the new changes.

34:34 And you have to, you have to do it in a try and try basis.

34:37 So you, you like update the new version and then try it, and run your tests.

34:43 And if they pass, then repin the new versions.

34:45 And if they don't pass, well, you've got to have to either, you know, in below it or block that version or something.

34:53 there are, there are messy things that happen.

34:55 yeah.

34:56 And it's getting more complicated with the new resolver.

34:58 Like if you say, I must have, you know, pedantic below some version and then FastAPI comes along and says, well, I must have pedantic above a higher version.

35:05 Well, whatever that other thing needed can't be used with fast.

35:08 Like there's these, these intervals that no longer intersect that can become challenging.

35:13 Yeah.

35:13 And like, let's say you've got an application, you're in the application, you're the only user of it or other people are, but you're not, nobody's importing it.

35:20 Then you can pin directly all of your dependencies and you can test it and it's great.

35:25 But if you're, if you're a library and you're, somebody is going to import you, you can't really just actually just pin everything because, somebody might like, let's say I'm, I'm pulling in requests.

35:38 Somebody else might be pulling in me and requests.

35:41 so you pinning it hardcore is you're, like you said, with the, with the dependency manager or the dependency resolver, that'll break.

35:50 So you've got to be a little bit broad so that these overlaps happen.

35:54 but okay.

35:56 So the consequences of this just nightmare is mayhem and, version conflicts.

36:01 Like we described, let's say I, my package says I have to have requests something and somebody else X and somebody else says, oh, well, I need to request version Y in mind.

36:10 and that's, it's just going to be a mess.

36:13 the, so all of these promises, the, the other, other subheading for, the promises

36:20 for Semver is that if you're on zero at the beginning, you can change it all you want.

36:25 So there's no promises on zero over.

36:27 If it's zero dot something, all bets are off.

36:30 You can change the API.

36:31 You can completely break things.

36:33 you can completely change the API.

36:35 So nothing before work.

36:37 and, in, in practice that doesn't happen, but, there are times where, in the, there's a, it's a lot of people are stuck in the zero over.

36:48 But you, in reality, the first few releases really are up in the air.

36:53 You're not sure what's going to work and what's going to not, not work.

36:55 But after a while, zero over just starts to be just there.

37:00 And you really should have been at one because everybody's using it.

37:03 but anyway, so.

37:05 Yeah.

37:06 And we covered that whole thing.

37:07 I think it was my mother.

37:08 I mean, I can't remember about the whole zero over thing and calling, calling places out.

37:13 yeah.

37:15 I mean, it's fine to have it, but like some of these projects had been out for 15 years and there's still zero dot something.

37:19 Right.

37:20 Yeah.

37:20 Like react was used by everyone before they released the first one beta.

37:25 Exactly.

37:26 Exactly.

37:26 Interesting.

37:27 Yeah.

37:28 You know, it's quite fun that, I don't know, some months ago, I updated a little bit, a little piece in FastAPI of some corner case that I had for some specific workaround for SQLAlchemy that didn't import SQLAlchemy, but excluded so much with some little thing over there.

37:47 And it was like deprecated, not used in the latest versions and not anything.

37:52 And I just removed it because it was there for a long time and helped break loose.

37:57 I had an issue that had like, I don't know, tens of, of thumbs up.

38:05 I tracked the issue, connected to the repository at Netflix that was using FastAPI for the, yeah.

38:13 And I, yeah.

38:13 Anyway, I had to release something quickly to get the book back because people were already depending on that.

38:21 And it's like, yeah.

38:22 Yeah.

38:22 Yeah.

38:22 Well, you have this problem that you have so many consumers of, I mean, 12% of all web frameworks are FastAPI at the moment.

38:30 That's a lot of people using your library touching the corners.

38:33 Yeah.

38:33 Absolutely.

38:35 Yeah.

38:35 Yeah.

38:35 So the last thing I wanted to touch on with this is, I do like, Hennix, instructions on what you should do about this.

38:42 You should have testing, but one of the things that we didn't bring up yet so far is if you test something against a update and it doesn't work, it might not be an intentional break in the API or the behavior.

38:54 look into it and maybe notify the maintainers that there's, there's a, that you are depending on some behavior that it broke.

39:01 Almost all this stuff is on GitHub and you can file an issue.

39:04 Yeah.

39:04 potentially or something like that.

39:06 And don't, don't just get mad.

39:07 People didn't break you on purpose.

39:09 So be nice.

39:10 Start out, start out with a, a generosity in your thought.

39:14 So there's a whole bunch of comments in the live stream.

39:16 Thank you.

39:16 I'm going to just try to like circle back on a few things.

39:19 One Magnus asks, how do you say or talk about, you know, verbally the square brackets and pydentic or even typing just iterable square bracket int bracket.

39:28 I've always said interval of int, just like you would use for generics or, templates and C++ like interval of it.

39:35 I don't know.

39:35 What do you guys say?

39:36 I have no idea.

39:37 I will ask.

39:38 I believe this key or maybe you could say like, what is the actual term?

39:44 I think it's one of those down there that doesn't have a name yet.

39:47 I don't know.

39:47 Yeah.

39:48 Yeah.

39:48 And then, Dean has an interesting comment on, versioning Brian talking, talking about versioning.

39:55 Why is Brian not updated Chrome?

39:56 There's a big update button right there.

39:58 And then, this one for you, Sebastian, although I believe we touched on this RJL a little bit ago.

40:04 any chance to ask a FastAPI question?

40:07 Will it ever become a web server like Django or Flask more than an API engine?

40:10 yeah, absolutely.

40:12 So the FastAPI will, you can use, you can do everything that you can do with Flask or Django with FastAPI.

40:19 You can render Jinja templates in the backend if you want.

40:22 FastAPI will not include an ORM by default because, that will compromise on tying it to a database and to a type of database.

40:32 Right, right, right.

40:32 And well, Flask doesn't as well, right?

40:34 Like Flask says go pick Mongo.

40:37 You're right.

40:37 You're right.

40:38 Go pick SQLAlchemy, something like that.

40:39 You're right.

40:40 Actually, I don't know.

40:41 Comparing to Flask, FastAPI will be pretty much comparable.

40:46 I think it's super comparable.

40:48 And, you know, I also, I created the, the decorators that you can put on the templates to, on the, of course, you can have endpoints to have like a chameleon template or a flat, sorry, Jinja 2 template.

41:00 And then, yeah, I'm actually working on a course.

41:02 I haven't told you, Sebastian, the course I'm going to release is building, proper web apps with FastAPI plus APIs, like sort of factoring that stuff in and like doing forums and stuff like that.

41:12 Nice.

41:13 That's very cool.

41:13 So yeah, it'd be fun.

41:14 Yeah.

41:15 All right.

41:15 So cool.

41:16 RJL likes the, the ORM news.

41:18 yeah, you can pick that.

41:20 And then also, Sebastian, you had such a good tweet a while ago and, Robert Robinson wants to just touch on that.

41:26 When will it be possible to have four years of experience with FastAPIs as companies are still yearning for it?

41:31 Tell people about your tweet.

41:32 You know, it's fun.

41:35 I tweeted something for, for those that maybe probably can see it.

41:39 I tweeted something, half a year ago.

41:42 It was saying, I saw a job post, requiring four plus years of experience of FastAPI.

41:48 I couldn't apply because I only have 1.5 years of experience since I created the thing.

41:53 So maybe it's time to reevaluate the, the experience is equal to, to skillset.

41:59 But like a bunch of people seem to have liked it because they tweeted it like crazy.

42:06 My Twitter app broke.

42:08 And now recently, I don't know why they started with tweeting it again and sharing screenshots of it on LinkedIn and tagging me.

42:18 And by this point, I have two years of experience with FastAPI.

42:22 So that is no longer true.

42:24 So now we, it'll be like 20, what?

42:27 2023?

42:28 Yeah.

42:29 2023.

42:29 These things will be legit.

42:30 Then you could apply for that job.

42:31 That'd be fantastic.

42:32 Yeah.

42:32 That's what you want.

42:33 I will get a job there.

42:34 Hey.

42:34 All right.

42:35 We're getting, long in the show.

42:38 So maybe our next two items should be kind of short, but, Sebastian, next one's yours.

42:41 Yeah, this will be short.

42:42 open API 3.1.0 was released recently.

42:47 FastAPI is based on open API.

42:49 So it's important for FastAPI.

42:51 and for whoever using FastAPI.

42:53 open API 3.1.0 doesn't change much.

42:57 it adds a more compatibility underneath.

43:00 So now it's based on the latest version of a JSON schema, which means that if you do things

43:07 like, for example, automatic react components based on JSON schema, now they will be able

43:12 to share the same schema as open API.

43:14 The previous open API was based on a very old version of JSON schema and the new one is based

43:20 on the latest version.

43:21 So we will have like all the compatibility all around the place in all the, all the different

43:26 tools.

43:27 So that's, that's a great, and it will allow like a lot of interoperability and integration

43:33 with other, with other tools.

43:34 Yeah.

43:35 Yeah.

43:35 For people who don't know, if you run a FastAPI API site and you go to slash docs, it'll

43:41 generate a whole form that gives you information about the Pydantic models that are exchanged,

43:45 the validation that happens, even lets you try it out.

43:47 Right.

43:47 Yeah.

43:48 And it's related to this.

43:50 Yeah.

43:50 Yeah.

43:50 And open API is an open standard that is held by the Linux foundation and it uses JSON schema,

43:57 which is another open standard, which is a, a in progress RFC, an internet standard.

44:03 And open API also uses OAuth 2, which is another standard.

44:06 So it's all based on standards.

44:08 When you, when you build an application with FastAPI, it's all based on standards and you

44:12 get an application built on standards.

44:14 Having this compatibility between these different standards and having all them synchronized now

44:20 will improve a lot of all that interaction between those different things.

44:25 That's really cool.

44:26 That's awesome.

44:27 Very nice.

44:28 So Brian, that's our, our items, right?

44:30 Anything you want to throw out there?

44:32 I am wearing this lovely Noah shirt from, national oceanic and atmospheric administration.

44:39 thanks to, Matthew Casari and Noah for the great shirt that sent it as a thank

44:44 you for speaking to them a couple of weeks ago.

44:46 And that's really cool.

44:47 They also sent a couple of shirts for my daughters and that was nice.

44:50 Thanks.

44:50 Yeah.

44:51 Fantastic.

44:51 That's really cool.

44:52 I'm sure there's neat Python stuff there.

44:54 Yeah.

44:54 So anybody want me to speak at their company and I'll, and send me a shirt, I'll wear

45:00 it online.

45:00 Fantastic.

45:02 Sebastian, we always throw out just little extra items.

45:04 If people, if you got anything extra, you want to let people know about anything you want

45:08 to share?

45:08 I just got curious recently about item, which is a kind of react in Python and you can use

45:14 it through Jupyter.

45:16 That's some, it seemed quite interesting.

45:18 I haven't played much with it.

45:20 I know I just checked the first demo that it works.

45:23 It's, it's a bit mind bending, but it's quite, quite an interesting experiment.

45:28 Yeah.

45:28 Awesome.

45:29 Okay.

45:29 Very cool.

45:29 People should check that out.

45:30 And Brian, it's true.

45:32 Everyone has a price.

45:34 Everyone has a price.

45:34 Some people, it's just a t-shirt.

45:35 That's awesome.

45:36 All right.

45:36 I got a, a four things I want to throw out there in the joke.

45:39 I'll make these all super, super quick.

45:41 So first of all, I wrote, I've been with all of my courses.

45:44 It's always like, Oh, do you need Python?

45:46 Do you have the right version of Python?

45:47 Are you on windows?

45:48 Oh, then here's what you were going to need to do to get your, like, here's how you check it.

45:51 You don't type Python three.

45:52 That will never work.

45:53 You type Python, unless you are on a certain version of windows 10, then it'll report that it's not there.

45:57 But like, there's just like, Oh my God, what is happening?

45:59 I just couldn't take it anymore.

46:00 So I finally broke down and wrote a, I don't have Python.

46:03 I need Python.

46:04 What do I do?

46:04 Oh, I'm on macOS.

46:05 Okay.

46:06 So then here's how you find out if you have Python and is a good version.

46:09 If not, here's three or four options for each OS, the benefits pros and the cons of potentially say using homebrew and then how you install,

46:16 if you want to go down that path.

46:17 And so anyway, I'll put a link into the show notes.

46:19 So people care about that.

46:21 Nice.

46:22 Thanks for doing that.

46:23 Yeah.

46:23 Yeah.

46:24 You're absolutely welcome.

46:25 Last time I was so excited.

46:26 Still, I'm excited about Boto3 type annotations.

46:29 But someone pointed out that this, you noticed the last updated two years ago,

46:32 there's a deprecated, Oh, there's a fork over here.

46:34 And if you go to that, it goes, you go down like, Oh no, no, no.

46:37 This is deprecated.

46:37 It's over here.

46:38 Eventually you end up at this, my pie Boto3 builder that uses my pie to dynamically generate

46:44 the type stubs for that are compatible with VS Code and PyTarm and so on for the Boto library.

46:50 So if you're really super interested in that thing I covered last time, you know,

46:54 check this out, follow the GitHub thing.

46:56 But use it fast before it's deprecated.

46:58 Yes, exactly.

46:59 Exactly.

46:59 And that comes from Dean Langsom, who is also on the live stream.

47:03 So thank you for that, Dean.

47:03 That's awesome.

47:04 We had Brett Cannon on the show.

47:06 Was that last time or time before?

47:07 That was the last time, right?

47:08 Very, very recently we had Brett Cannon come talk about various things, including the pattern

47:14 matching stuff.

47:15 He also talked about Python launcher and we threw out like, Hey, if I'm in a subdirectory of

47:21 some project and somewhere up, there's a virtual environment.

47:23 And I just try to run it.

47:24 It should automatically find the whole project sort of ambient virtual environment.

47:28 So he apparently added that for us.

47:30 Yeah.

47:30 I just tried it this morning.

47:31 Awesome.

47:32 Yeah.

47:32 Fantastic.

47:32 Nice.

47:33 Then last thing I'm thinking of doing an ask me anything talk Python episode where I get

47:38 some people in the audience to interview me and ask the questions of the audience just

47:42 about the show.

47:43 So I'll put a link in the show notes.

47:44 If you have a question you would like to ask on talk Python and make it part of the ask me

47:48 anything, we'll do that.

47:49 And we'll live stream it on YouTube as well.

47:51 All right.

47:51 So that's all my, my extra items.

47:52 We need a joke.

47:54 We need a joke.

47:54 All right.

47:55 Well, last time I really enjoyed this one.

47:57 So I thought the, the, the funny code comments.

48:00 So I thought we might come back to this.

48:02 So, so I think I'll kick it off, I guess.

48:06 And then Brian, you next.

48:07 And then Sebastian, you can, you can pick up the third one.

48:09 How's that sound?

48:10 Sure.

48:10 Awesome.

48:11 All right.

48:11 So here's a comment that kind of misunderstands exception handling constructs.

48:17 So try finally comment in the finally block should never happen.

48:22 I'm sure they meant try exception never happen.

48:25 No, no, no.

48:27 Try finally.

48:27 That probably almost always happens.

48:29 Yeah.

48:31 That's a good one.

48:33 Right.

48:33 All right.

48:33 Brian, you're up next.

48:34 Oh, okay.

48:35 So comment that says, looks like C code because of the comment style, but, you may

48:40 think, you know, what's the following code does, but you don't trust me fiddle with it.

48:45 And you'll spend many a sleepless night cursing the moment you thought you'd be clever enough

48:50 to optimize the code below.

48:51 Now close this file and go play with something else.

48:54 All right, Sebastian.

48:57 The next one's yours.

48:58 So there's this, declaration of a constant integer with a name of capitals T E N.

49:05 So 10.

49:06 And the value is the number 10.

49:08 And the comment says, as if the value of 10 will fluctuate.

49:12 You know, you don't want magic numbers in your code.

49:16 Like, like blue might be better than some hexadecimal number or like max limit might be

49:22 10, but just the word 10, there's no reason for that.

49:25 That's awesome.

49:26 All right, I'll do the next one here.

49:27 I am not responsible for this code.

49:30 They made me write it against my will.

49:32 I like the last, it's the next one.

49:38 So, if this code works, it was written by Paul.

49:42 If not, we don't know who wrote it.

49:44 All right.

49:49 and then the last one says option.

49:51 So is the declaration of options dot batch size is equal to 300.

49:56 And then the comment says madness.

49:58 And then screams.

49:59 This is Sparta.

50:01 This is Sparta.

50:03 Then from the movie 300.

50:04 Fantastic.

50:05 Oh my goodness.

50:07 Nice.

50:08 That's great.

50:09 Awesome.

50:09 Well, those are some really good, important comments.

50:12 All of them.

50:12 I think the Sparta one kind of inspires.

50:14 You're like, we're going to go to batch size 300.

50:16 Let's do this.

50:17 The others.

50:18 I don't know about them so much.

50:20 No, I'm going to start doing the, if, if this code works, it was written by me.

50:24 but you know, we have version control.

50:26 You can, you can just look it up.

50:28 Yeah, that's true.

50:29 There is a blame.

50:29 Well, that was fun.

50:31 We're done.

50:32 Thanks everybody for joining us.

50:34 thank you, Sebastian for joining us.

50:37 This was great.

50:37 Thank you for the invitation.

50:38 Thanks everyone for listening to my weird voice.

50:42 Thanks for having us.

50:43 Sebastian, it was great to have you here.

50:44 Thank you.

50:45 It was awesome.

50:45 Thank you.

50:46 Yep.

50:46 Bye everyone.

50:47 Bye Brian.

Back to show page