Python Bytes - #307 Your Python just got faster (3.11 is out!)
Episode Date: October 26, 2022Topics covered in this episode: Python 3.11 is released Installing Python 3.11 on Mac or Windows Bossie 2022 Awards Textual 0.2.0 Extras Joke See the full show notes for this episode on the webs...ite at pythonbytes.fm/307
Transcript
Discussion (0)
Hello and welcome to Python Bytes, where we deliver Python news and headlines directly to your earbuds.
This is episode 307, recorded October 26th, and I am Brian Ocken.
Hey, I'm Michael Kennedy.
Yay! Well, it's pretty exciting here in Python world this week.
Oh, it's a big deal this week, absolutely.
It's a big deal. So tell us why it's a big deal. We've talked about Python being faster and new features coming along.
But primarily, I would say there's like two ends of the spectrum that people have been really looking forward to.
One is, wouldn't it be great if you did nothing and your code ran 50% faster?
Brian, you and I are of similar age.
And I remember it was just like,
well, wait till next year till I get a new computer,
and that program that's a little sluggish
is going to be zooming along, right?
And just like computers would just double in speed all the time,
and we don't get so much of that anymore,
but with Python, we kind of do this this time around.
Yeah, I remember also adding more memory
and trying to detect whether I could tell a difference for the $100 I spent.
Yes, exactly.
Exactly.
Or optimizing your low mem versus high mem.
I mean, that's going back always.
But the big news is Python 3.11 is out.
Woo!
Yay!
Yeah.
We should have had champagne or something.
Yeah.
Yeah, pop some corks.
So very big news.
I'm super excited about it.
I told you there's this end of the spectrum.
The other end of things that people seem to be psyched about across the board is better error messages.
Yeah.
I mean, it's very important for debugging and also for teaching people and learning Python.
Yeah, absolutely.
Absolutely.
I got to pull this one off just for nostalgia's sake dave in the audience says back when we had turbo buttons
our computers that you literally had a button that said turbo i remember when i got my pinium 90 it
had a turbo button and i'm like yes what it really meant is if it was off it would run in like some
weird retro slow modes i would like play mech Warrior and stuff would like zoom around insanely fast.
But if you took off turbo,
you could play some of the older games
because they weren't based on time.
They were based on frame rate.
Anyway, crazy, crazy memories.
So we're kind of getting that cool
like doubling of speed thing here.
So there's a ton of stuff to talk about
in terms of what's available here.
Before I get into the details,
I want to point out on YouTube,
which I'm linking to, Python Discord, Lemon over there, hosted a live stream of the
release. So this is not a party celebrating the release, but this is live broadcasting of the
actions and the steps as it's being released. Like, okay, the final one is built. Okay. We pushed it to the Microsoft store for windows, windows store install. Now we pushed it to, uh, you know,
python.org. Now it's over here and like, right. Like the actual pushing of the deployment. And
there's a bunch of interesting things that happen there. And along the way, they talk about some of
the features. I'm going to have a subset of the people that were there in apparently 46 hours on Friday
on TalkPython to make an episode out of it there as well.
That's pretty cool.
It's neat that they do that.
So people can just watch the process.
Yeah, it is cool that they do that.
And I saw a pop up and like, these guys are going live.
I'm like, oh, that's playing on the background while I'm working today. You know, I'm going to be apparently at 80% capacity of like getting
stuff done, but I'm going to enjoy it a lot. Also, we have a logo, which is not the official
Python logo, but a Python three 11 logo. And it has like little, it's like two snakes,
but they're not the Python you know cartoon dramatic like sort of
stylized snakes they just look like snakes and it says faster python python exception groups and
accept star typing improvements and like literally the logo basically is the release notes but
and it has a lightning bolt in the middle i guess that means fast i think think so. I think so. All right, so let's see. Major new changes.
We've got fine-grained error locations and tracebacks.
Let me see if I can get it to show us some interesting example here.
Yeah, this is super cool.
So check, there's a line if you just follow the pep there.
There's an example of, suppose you're calling like a complicated JSON API
and you get this data back
and you store it in a variable X
and you've got to go to some field in the JSON document
and then further down and further down and further down
and like either get or set a value.
So here it has X bracket of A bracket of B bracket of C bracket of D.
So you're like diving from like level A, B, C, D
in the JSON document.
If you get the error,
none type is,
or object is not subscriptable,
you know something there was none.
Yeah, but you're four levels deep.
Which one was it?
Right, it could have been B wasn't subscriptable
or it could have been C or it could have been like,
you don't know where.
And so what a hassle, right?
And you do print statements
and that's when you do debugging statements.
That's when you maybe make that four and that's when you do debugging statements. That's when
you maybe make that four different lines, so you see which line crashes. Well, in 3.11 now,
it just says tilde, tilde, tilde, caret, caret, caret. Look, you had x of a of b of c. It's c
that was the none thing. That's where the problem was. Actually, I suspect that probably, yeah,
I guess it's probably c. We tried to get d out of none, and c was none is probably where the problem was. Actually, I suspect that problem, yeah, I guess it's probably C.
We tried to get D out of none and C was none is probably where the error was.
Yeah, but it points like right where
these problems are throughout there.
Yeah, really neat.
Plus a whole bunch of others.
Yeah, there's a bunch of other ways
that they're highlighting where the problem is.
Yeah, if you go through,
there's a bunch of cool examples here.
But basically, you end up with within complex expressions,
multiple things happening on one line and so on.
You get nice details there.
Pretty cool.
So that's just one of them,
but I would say if you don't care about performance,
that's probably what you might consider the highlight.
If you're an async IO, async and await type person,
async exception groups, PEP564 and except star are pretty interesting because if I start three
tasks and I wait on them and two of them have errors, well, which exception do I get? Do I get
the one from the first one or do I get the one from the second one uh so it would be great
to be able to say two of the three things failed here are their problems right so you can kind of
get a holistic view of what's happening that's great yeah i'm actually i'm actually can i'm i
still haven't got my head around this completely but i'm curious to see how that this will change
sort of um python style uh because this changes how you can write exception handling.
Indeed.
Some of the higher level async frameworks
like Trio and Any.io
have this concept of starting
and managing a series of tasks together as a group.
So if I'm going to save an entry to the database, I'm going to call an API,
and I'm going to create a file. And those are all the all a result of like, I want to
create a new user, I want to do whatever, right? You might want to be able to say,
I want to start all those and wait for them to finish. Or if I start a couple of them to decide
I want to bail out, cancel all of them, or if one fails and so on. So we've got this concept of a task group in async IO and changes to the task cancellation
semantics. And it's interesting, we've got, you know, PEP 657 was the traceback enhancements,
654 was the exception groups, but the task groups is GH 90908.
Do you know what GH stands for?
GitHub.
Okay.
Weird.
So it's news to me that these features get added
through just a GitHub issue rather than a proper, you know, pep.
But anyway, yeah, pretty neat.
Maybe you're pronouncing G-H as p,
like a...
Exactly.
Let's see.
Henry has some cool comments
following up out there.
Henry Schreiner thinks,
caters is already using exception groups
via backport exception group.
It is fantastic
and really does change Python exceptions.
So, yeah, cool.
Cool extra information there.
All right, let's keep going.
You've already talked about Tomolib being built in.
Now that we have pyproject.tomol,
should we really have external libraries
in order to understand them?
Yay, now we get to do the if block,
if import Tomolib, or, know the try accept around it because exactly
how fun yeah yeah it is a good thing though i'm glad for that yep there's changes to regular
expressions if you care you know all right and then um we've got basically a general statement
saying the faster CPython project
is already yielding some exciting results.
That is Mark Shannon, Gita Van Rossum,
and a bunch of other folks, Grant and others,
all working on this.
And it says already yielding exciting results.
Python 3.11 is up 10 to 60% faster than just 3.10.
That is just from last year, right? Hence the turbo button. Python 3.11 is up 10% to 60% faster than just 3.10.
That is just from last year, right?
Hence the turbo button.
On average, we measured a 1.22 or otherwise known as 22% speed up on the benchmarks for Python tests or Python benchmarks.
You can see faster Python for details.
There's already some of those we're making
to 3.10, 3.11 is getting more,
3.12 is getting more.
It's just
a first down payment, I guess, but it's really great
to see that happening.
A bunch of stuff around typing.
Those are a lot of the other highlights there.
Two things that are worth calling out here,
I would say. One is self. It's good to be self-aware, right, Brian? Yeah, it is. And so Python classes can now
understand that they too have a self, even though they say self all over the place, like
another language, right? Like this in C++ and C sharp is a thing you can, but not must use,
or you got to say self.
So ironically, the typing system now also understands self.
And you can say what the problem was before. If I'm in a class and I have a method of that class that returns an instance of that class,
the class is not yet defined as far as Python's concerned until you're to the end.
So I can't say the return type is the name of the class because until you're done the class is
not defined right it's like this weird error so what you can say is it returns self and whatever
self is that's what it returns and one of the the changes and difficulties was to make this work
with inheritance yeah i mean like in c or in c++ you have to pre-declare the type ahead of time.
But then, yeah, anyway.
We don't have declarations in Python.
We don't.
I wonder why we don't have a two-pass compiler that scans for types and then expands out the details.
Do you know what variadic generics are?
Putting you on the spot. Sorry.
You are putting me on the spot.
Let's see. I just want to use that word more i know it sounds like yes i do have a phd in computer science
uh it enables the creation of generic parameter i uh generics parameterized with a single type
so this is something i don't do much of in Python types
is you can create a type variable
that then defines the type of a thing
and then use that variable.
It's kind of like templates a little bit.
And so this has to do with that.
I don't think I'm smart enough to use this.
If you look at the example, you can say,
I've created an axis one is like a type.
And then I can say I have an array,
which is of generic you know of generic of
axis one axis one right like i don't know it's i kind of left that kind of stuff behind in
c++ like the multiple good some somebody's helping us out dean is saying when i learned
about periodic generics i thought maybe we've gone too far with typing thanks dude you don't one thing that's
nice about python is often you don't have to know or care or consume you don't have to use it you
know what that doesn't apply to me yet maybe someday not right now there's other stuff of
course the last one i think is where it is noteworthy um has to do with limiting the spread of little Bobby tables, let's say.
And these are arbitrary literal string types.
So the idea is if you've got, say, like a SQL query,
it would be great to somehow define,
here's a string that I want to put into code,
but I don't want it.
It's kind of like a static string in a sense.
It can't be modified or added against non-literal strings.
So the example says, look, I've got slick star from data
where user ID equals F string curly user ID.
And if you say user one, two, three, good.
But you also might say user one, two, three,
semicolon drop table data, semicolon.
Or you could do, you want to get all the records. You say user one, two, three, semicolon, drop table, data, semicolon. Or you could do you want
to get all the records, you say user one, two, three, or one equals one, right? Like these are
bad. So what you can do with these now is you can come up with literal strings. And they in order to
make the query work, you have to use database parameters, you just put like a placeholder in
the string that never changes.
And that way, basically, your string, in a sense,
is safe from injection.
Okay.
Yeah?
But you still can pass parameters in,
but you just have to do it a different way.
Right.
And so in this example, they have select user.name,
user.age from data where user ID is question mark.
That's the indicator of a SQL parameter.
And then you say connection execute givenql parameter and then you say
connection execute given that string and then you pass the parameter which has the value of the user
id and then the database engine knows like that can't like truncate a statement right it can't
sort of modify the command you send what's notable though is you can also add on things you can
change it and combine it with other literal strings,
but not with non-literal strings.
Okay, interesting.
Yeah.
That's what this literal string type is here.
And yeah, anyway.
So people can check that out.
I think that's going to be useful in a lot of situations
where you're trying to be safe with user input, basically.
Yeah.
All right, is that it?
I think that might be all the highlights.
Yeah, there's a...
Go get your version.
I've already brew installed my 3.11, which is cool.
You brew installed, okay.
I did.
Now, if you just say brew install Python 3 you'll get 3 you'll get 3 10
7 i think or 8 something you won't get 3 11 but you can rue install python i think it's at 3 11 or
at 3.11 you'll have to have to look i don't remember the exact command but there's a way to
say no i want the cutting edge version and i was already final
thought on this we'll move on i was already given a small cut by it you were i was so the python
bytes website is based on beanie the mongodb pydantic combo of glory because it's all async
it's based on motor the async driver for Python and MongoDB
from the MongoDB folks.
They built that thing in the super early days
before async and await was a thing based on Tornado.
So they don't use async def for their async functions.
They put at asyncio.coroutine as a decorator
onto all their async functions.
Well, that was awesome until 3.11 where that was removed
from the runtime so uh that doesn't work anymore and it doesn't run so well either so the motor
people had to rush out 3.1.1 yesterday after uh much conversation of like uh you guys realize
you should have tested on 3.11 beta or rc1 or rc2 or any other release at some point
because clearly this code was never going to run and you should have known straight away but at
least they fixed it quickly okay so henry wants to know how did you find it apparently it's on
unmerged pr uh perhaps i i just did brew update brew outdated and it said new recipe or new whatever the call
new whatever it calls those things the new recipe python 311 i said oh cool then i'll install python
311 okay yeah that's how i know so i want to stick with this install thing a little bit
um because i would think that you're probably a power user. I mean, kind of. You know Python pretty much, and you're
trying to be cutting edge and everything.
I think that a lot of Python bloggers
and
social media
people that are famous in Python
are probably the power user kind of people.
And they tell people
weird things, I think.
Like brew and stall Python.
Just brew and stall. And I don't think it's a good idea.
So I'm going to get on the soapbox a little bit and say, I wrote an article on how to
install Python.
And it's installing Python 3.11 on Mac or Windows.
And we'll get to Linux in a bit.
But so the gist is you go to Python.org, you hover over downloads, and you click download.
And then the thing that gets installed, you install it.
Now you're done.
Okay, so why did this deserve an entire article?
Well, because I think a lot of people are teaching people to do like saying, just brew install it or do PyInv. And and pie and I anyway, we'll get to there.
But so I just want to tell people how long does it take? It takes about a minute. I took I did it.
I timed it on both my Mac and did it on a Windows machine and just installing everything um takes uh yeah it took about a minute a minute and 13
seconds on my mac and this is including me having to hit stuff so it's also my delay uh and then
also did it um on windows it took like twice as long but i was tunneled through a vpn and
firewalls and stuff so it probably it's probably all that. It's pretty fast. You
can have, and it doesn't uninstall anything. So you can have multiple versions. So it, it will,
like if you, if you use that sort of download link for like the latest, like three, 10, eight,
it'll, it'll go over the top of three, 10, seven, I think at least on Mac, it does that.
But that's okay. It's kind of what I want. I've got three 10, you can have multiple, I give three 10, three, seven, three 11,
all on my machine, just with those links. And it, the three 11, just as the default, I,
it just, I think it's the newest one and the oldest. Anyway, it modifies the Z profile,
your dot Z profile, and it shows up as the latest one.
Now, if I had 3.10 before, what if I go back and install the update my 3.10?
Will it make 3.10 the default?
No, it doesn't.
It leaves it alone because it was already in there.
It leaves it B.
But you should check anyway if you're going to go back and install old versions.
And Tox works just great with it.
So why am I kind of ranting on this is because a lot of people try to say Homebrew.
And if you're a Homebrew user, you're not going to look for this blog anyway.
You're just going to try to do it with Homebrew.
Great.
Go for it.
You're perfect.
And PyEnv, I think there's some places for it.
But PyEnv is about managing different versions and having multiple live at the same time and different projects use different ones.
It's not just an easy installer.
And since it does all that other stuff, I don't think people should recommend it for newbies.
It's not the right tool for somebody new to Python.
I think it's just going to confuse the heck out of people. So that said, I walked through the whole thing in this article, but I also admit that it's Mac-focused.
But on the Windows, I did a little blurb on Windows, too.
The thing I want to tell people that I sometimes forget on the Windows install is go slow when you're clicking through everything so that you can select the advanced features and you probably want add python to environmental variables
that makes it so that just shows up in your path because you can add that to your path manually
or you can let the installer do it and i like to have the installer do it so that's uh that's my
rant i think that um for most people, just use the default installer.
Yeah, I think that's totally good advice.
Let's see here real quick.
I also did that the other day
before it came out in brew.
I'm like, oh, let me just put it over here
and see, I wanted to test some things.
And I had 3.11
and they were both totally content
next to each other from those installers.
I just decided to take 3.9 out
because I didn't really, I don't really need that.
I've got it from home brew as well already.
So, but they do, they do coexist.
It's fine.
And here's what the brew statement is.
It's new formula, formula, and it's Python at 3.11 is what you can.
Okay.
So.
Nice.
Yeah.
And as for Linux people,
I think it's sort of funny
that people try to tell,
if how to install Python articles
talk about Linux stuff,
Linux people already know
how to install their stuff,
don't they?
I mean.
Yes, but although
it's more complicated
because Python's broken
into a bunch of pieces.
You want Python
or do you want the Python dev bit?
Or do you need the build essentials?
Or like there's a lot of like, do you need Python 3-V, E, and V?
Because you want to create a virtual environment that don't come with Python when you apt install it, which is like, what?
Okay.
But they do on Mac and Windows.
Yes, exactly.
At least the error message is, you don't have this.
Should you apt install Python 3-VNV?
Yes, I should.
Let me copy and paste.
Hold on.
Yeah, okay.
All right.
I see Roman out in the audience there.
Roman, I've got some shout-outs for you in a little bit,
and in the past, if you weren't here.
But before we get to those,
I want to tell you about this week's sponsor,
Microsoft Founders Hub, Microsoft for Startups Founders Hub.
As they have been recently, big supporters of the show.
We really appreciate it.
And if you're out there either starting a business or want to start a business, got to know that it's not easy.
Within the first year, 90% of startups go out of business.
That's not amazing.
So the folks over at Microsoft for Startups set out to understand what are the problems that people are running into and how could they help.
So they came up with Microsoft for Startups Founders Hub.
And the idea is that you get, at any stage of your startup, free resources to grow and thrive. So you get thousands of dollars of cloud credits
for things like Azure and GitHub
and DeepMind, OpenAI, sorry,
for those types of things.
And as your startup grows and progresses,
you get many, many more of those, but you also get
support in the form of mentorship and connections. Brian, you're not in Silicon Valley, are you?
No.
Neither am I, by choice, by the way. And most people out there listening are not either, but
having the connections of like, hey, let's meet up with so-and-so for coffee and talk about this new project and see if there's a connection there, right?
Those kinds of things are incredibly powerful and they've given people in locations like that huge advantages.
So the other thing you get with this is access to a mentorship network, the ability to book one-on-ones with meetings, one-on-one meetings with mentors, many of whom are founders themselves.
You can talk about things like marketing
or fundraising or whatever you need.
So if you want to get started,
make your dream, your company a reality today
with the critical support you get
from Microsoft for Startups Founders Hub.
You don't have to be third-party validated.
You don't have to be venture-backed
or part of some kind of accelerator. Just go and apply for free. PythonBytes.fm slash Founders Hub 2022. Link is in
your show notes. Check them out. Very cool program. Very cool. Indeed. All right. Ready for some
awards? Got the red carpet out, the champagne, more champagne there's some some kind of theme with that here celebration yes let's talk about the bossies so the bossies uh this is info world's
2022 bossy awards celebrate the most important and innovative solution or application developments
devops analytics and what uh the year so let's go. These are open source. Oh, best open source software.
I was like, where did this boss come from?
Okay.
Exactly.
There's a bunch that are interesting,
but we'll go through.
You can't go through very fast.
There's like a delay, I guess,
so you pay attention and you actually take it in.
So maybe really quick,
just because it's the first one,
is there's Alma Linux,
which is a free Linux OS for the community by the community
that is like an enterprise
Linux distribution focused
on stability so that might be cool
checking out I know a lot of people
do things there you have to bear with me
as I make my way through this thing
as it won't let me go any faster
well let's do the first
one there's a lot of Java
in here actually which we'll get
back to in a joke later that'll be fun like j hipster i mean greetings java hipster that's a
pretty awesome project but java hipster that seems sort of anachronistic you know you gotta
this is part of that um self-talk thing where you like try to talk yourself up a little.
All right, maybe number one
that I want to give a shout out to,
number one as in number 10 in the list is WasmTime.
A fast and secure runtime for WebAssembly
outside of the browser.
So if you think about what Node.js did for JavaScript,
like JavaScript used to be this thing
you did on web front ends.
And then somebody said, if we rip that engine out, it be a server side technology or a client side technology that is not
in a browser at all but just it becomes a programming language as long as we have a runtime
that everyone likes and works with well this is like that but for web assembly right and so what's
interesting is if you want to go and run a Python code
and you don't want to worry about making sure Python is set up
and all those things, you could just get, say, something like PyScript
and ship it to run on top of Wasm time, and there you go.
So you just say Wasm time and then some Wasm output,
which could be your code know, your code.
And let's see if they have over here on PyPI, we have Wasm time 2.0, which is the Python embedding
of Wasm time. So there you go. Take your Python code and off it goes. That's pretty cool. So
Michael, what time is it? It's Wasm time. It's Wasm time.
It is.
Awesome.
Yeah, so you just write your code in Python and then you could go and run it,
which would be pretty excellent.
Also, something interesting about Wasm
is it allows for interoperability.
So if I wanted to do C,.NET, Python, and Rust
and have those all talk together because, I don't Python, and Rust,
and have those all talk together because, I don't know, I couldn't decide
or I don't know, whatever reason, right?
You could have them all converted to Wasm
and then integrate there as well.
So there's some pretty interesting
runtime and deployment things here.
Anyway, so that was one of the winners.
Right behind it,
one of the biggest winners in our world
has got to be PyScript, right?
Yeah.
It's a cool account on the list.
Yeah, it is.
There's a bunch of stuff here that I don't care about.
But number 14, Sentry.
Nice.
Error monitoring.
I was just using this to track down some errors
that I introduced with trying to run Python 3.11 and Beanie before it was time. But it told me exactly
what was going on. And I figured, okay, that's a motor problem. I was able to track that down,
which is pretty excellent. Let's see a few more here that are fun, almost. NBDev. If you're doing
notebook stuff and you want to be able to test your notebooks or clean them up before you check them in or you want to turn
notebooks into a python package where certain actions in a cell become functions in your python
package and deploy it to pybi all those crazy things nbdev so those are pretty interesting
uh accelerate i think this is from hugging face but i can't quite tell yeah it is hugging face
that's what it is uh it's a way to build train and deploy state-of-the-art models powered by
open source yeah so anyway it looks looks interesting if you're into that stable diffusion
do you need to have a bear that has just landed on the moon? Well,
go in there.
You can create those, uh,
funky,
funky AI art things.
Anyway,
there's a bunch of fun projects in this 2022 bosses award list.
Yeah.
That's pretty great.
Yep.
All right.
Yeah.
Well,
Scott,
it's wasm time.
It's wasm time.
Yeah. We, we, we talk about Will McCougan a lot, uh, and, Scott, it's wasm time. Yeah.
We,
we talk about Will McCougan a lot and textual and stuff.
And so Will's in the audience.
Hey,
Will.
So one of the things that if you follow Will on Twitter,
he shows a whole bunch of cool examples of stuff he's working on,
but you haven't been able to play with it because he's been sneaky about it.
And it's been on us. Well, it's not sneaky it and it's been on us well it's not sneaky but
it's been on a css branch different branch of their their uh um code base on uh textualize or
textual so um so now we can play with it because as of what october 22nd um textual 0.2.0. Wow. Big jump in numbers there guys. Um, but it, uh, it released and it has all
the CSS branch stuff merged in. So all the really cool, fun things that you can do that looked like
web development and, but they're in, in a CLI. Now I can start playing with them because they
emerged in, um, one of the things that I'm glad that they waited a little while for because they merged in. One of the things that I'm glad that they waited a little while for
because they were looking for API stability,
but also they wanted to finalize the documentation at the same time
before they released it to everybody officially.
So they've got a tutorial written, which is really kind of nice.
It's a little stopwatch application that kind of walks through,
and it walks through all the different pieces of how you use Textualize
with their CSS.
And it's got going through, writing through the CSS,
the dynamicness of it, reactive attributes.
This really looks great.
I haven't gone through it yet, but it looks awesome.
And then they went through and updated the textualized guide, um, which has,
um, you know, it goes, goes through all the different examples and I've got my screen
shrunk up too far, so it doesn't show everything. But anyway, um, really great stuff in this, uh,
in this, this manual. Um, good job guys. Yeah, that was looks awesome so i can't wait to play with it
yeah who knew that we could treat uh treat terminals as high refresh rate general rendering
engines it's i feel like the stuff that will and crew are highlighting here is a little bit like
what you could do with javascript canvases right you're like oh guess what you could actually do which is you know like our software here stream here that we're using to
live stream this right it's like uh who would have ever thought you could have done this with
just a web browser without plugins right and here we are and i i also just heard will talking about
this on changelog um just recently one of the more recent changelogs was talking about this
release, which is pretty cool. Although
Will, I gotta say I'm a little disappointed
because
they asked how you
became rich and
textual have gained so
much popularity so quickly
and you didn't even mention us.
Just, come on.
Anyway.
Cool. mention us just come on anyway cool anyway uh that's it for our items um and uh since i've been kind of under the weather i don't have any extras do you have any extras for us
uh you know that i do i've got a bunch of things i'll go quick through them so i recently did a fun video i know that guy
yeah i did a video where i added i did the live coding on talk python training actually
adding the feature for uh the search over here so i rewrote the search you pointed out that pi test
is a fun thing to type in there, right? My test is good.
You might search for Postman Ingrock and you get your search results there.
Got this cool hierarchy thing.
But when I first wrote that, it was like super slow.
And the techniques that I used to debug that,
figure out what's going on, make it faster.
The video says 17, but like in an extreme case,
it was actually 80 times faster.
There's just some
really cool techniques of walking through like oh how could you like use logging in the database to
figure out what's happening how could you use the profiling how we use dictionaries so that we can
convert like 100 database calls into one even though there's like a not a natural join story
going on so if people want to follow go check out video. That's lots of fun in the show notes. From, let me get the name right here. Also from Ryan Sheftel. If you're into stock markets and go on and use pandas, here's a project called Pandas Market Calendars. It's the market calendars used with Pandas for trading applications.
So it has things like,
when are the markets opening and closing?
Is there a holiday?
Is there some other weird event
that's changing the start to close time?
Right, so just a cool little library
to bring that into your Pandas code.
And I believe Pandas came out of New York
and the whole trading industry over there.
So that's good.
Shout out for Roman Wright, who is out in the audience. industry over there. So that's good. Shout out for Roman Wright,
who is out in the audience.
Hey, Roman.
We recently,
and so when Beanie came out,
Beanie's fantastic,
MongoDB library,
you know, what FastAPI did for APIs,
Beanie does for MongoDB, right?
It takes Pydantic
and turns it into a really cool API
that then you use
instead of creating just classes
or whatever, right?
So all the benefits of having Pydantic plus MongoDB.
And when it came out, it was only async,
which is awesome when you're doing async stuff, right?
Without it, you can't do all the really high scale,
high concurrency things.
But there's plenty of times where you're like,
I don't want that.
I just want to call this function
and I'm in the middle of a script
that has no business being async, but you gave me an async only function.
So now I got to figure out how to like spin up a loop and run this thing and wait for it when I
just want to call the function. And so in addition to the standard async model, Roman added a beanie
dot sync sub module where you can get a sync document and you get a
you can initialize a synchronous
database connection and then all of your
queries and everything become just
straight up
synchronous calls like on more traditional
database engines or database
ORMs, ODMs.
Okay. Yeah.
Excellent work out there.
Good job keeping up on that. It's a cool project. Yeah, it's a good job uh keeping up on that it's a cool product
yeah it's super cool yeah i love it uh duck duck go has released a web browser just when you thought
chrome has taken over everything duck duck go says no or they quacked no or whatever duck duck does
when they communicate and right now it's mac only but it's coming out for windows uh pretty
soon as well and it's a privacy focused database um web browser yeah yes i said davis yeah web
browser um but let me let me show you i can even just show you real quick here it is but did you
install it oh of course i did why wouldn't I do that? Here it is.
So we go over here.
We can go to pythonbytes.fm.
And if you pull this up,
why not?
Didn't add to stream.
There we go.
We'll come over here to Python Bytes.
And you can click on this.
It'll show you where all the tracking is. Notice, no Google Analytics, no other tracking.
But where shall we go?
Somewhere super egregious. We could
go to cnn.com. And remember, this is using already NextDNS and other blocking. So a lot of the
blocking happens before it gets here. But if you pull it up, it'll still say, look at all these
different things we blocked. And here's the tracking. Here's the advertising. Again, many of these are already blocked
before it gets to the network.
So it'd be 30 or 40, easy.
So that's pretty cool.
But I don't know.
I'm not switching over to it yet.
Hopefully they can do better.
You can't do things like set your DNS servers
for say DNS over HTTPS. So you can
like have more control over that. There's, there's a lot of things that are, are not there. It has a
really cool way to play YouTube videos in like a private window. So if you go over to YouTube and
you hit play, it'll, would you like to play this in a non-tracking, non-algorithmic feeding sort
of way, which is great. But you know what you have over on youtube hotkeys i can type f for full screen or t to like go wide theater mode or i for mini player it doesn't have any
of those types of things right and so it's like super super early but so in that regard i'm i'm
not really psyched or recommending it but it's awesome that they're trying i like duck duck go
i'd like to see them make progress here and they have the fire button which you can just um clear all the stuff up and get a cool animation what does that do just it erases
erases like all history and closes all tabs and and everything oh cool yeah yeah anyway there you
go i think i've got one more thing to share but i've got to share my screen back because of that. Nabbed it.
Yeah, last one here before we get to a joke.
So I want to give credit here.
This one comes from Will Shanks.
Remember when we talked about int, like I-N-T,
parentheses, some string, like quote, one, two, three,
close quote.
That had a security patch in Python 3.10.7 because if you send it the right malicious huge number string,
it can get into some denial of service
where it works for an insane amount of time
trying to figure out what that number is by parsing it.
Not just a big number,
but a specifically bad big number, I think, was the problem.
So in 3.10.7, they said,
you know what, we're going to limit the size
of int to i don't know like 9 94 with 100 zeros or something after right at the time you and i
spoke about remember when we did c and c plus plus and c sharp and we had to think about shorts and
you know 32-bit integers and 64-bit integers. And would it be bigger or smaller than 32,000?
Do we need to worry?
And like that number is so huge,
like we probably don't think about it.
Well, some people do, in particular, the scientific folks.
So over on CondaForge,
there's a big conversation about what to do here.
Like, should we adopt this?
Should we say this is like too much of a problem?
I mean, I don't really know how they're going to avoid
eventually adopting it.
Yeah.
Because like every version of Python going forward
is going to have this in it, right?
They don't want to eventually,
like permanently be held back.
But on the other side,
the, what's it, Ubuntu?
Let me look.
Yeah, Ubuntu has decided to patch out that int limit.
So basically unravel that security fix
and preserve the behavior previous behavior thinking that the risk is low of getting an
integer like that and it's not worth breaking compatibility for okay so apparently int open
parentheses string close parentheses is still controversial who knew knew? Not me.
Yeah.
All right.
Let's see.
Robert Robertson asks,
in Python Bytes episode 311,
is that going to be a special episode covering Python 311?
I don't know,
but we got five weeks to figure it out
and it's a great idea, Robert.
Thank you.
Sure.
Good idea.
I didn't see that coming.
Yeah, we should have coordinated with the Python folks.
We could have just released like five really short episodes.
Like, still waiting.
Nope, can skip to the next one.
All right.
Well, that's all I got.
That's all I got for extras.
Well, one of the things I want to,
an extra from the audience,
Dean Langsom,
probably did a TLV. Tel aviv tel aviv is on december 13th and
they have tickets up for sale and there's a code so if you use discount code uh b-y-t-e-s
you get a discount i guess so that's nice awesome yeah good luck with the conference there dean
and how about lovely city to visit if you get a chance to.
Okay, cool.
How about something funny?
Yes.
All right.
What size is my voice?
Here we go.
See if I can open the image.
It's glorious.
So Brian, I was thinking about getting a new monitor.
I have a fine monitor.
It's like a 32-inch 4K monitor,
but I want something kind of widescreen. There was this cool, like horizontal resolution equivalent
on 4k, but it was 40. It was either 40 or 49 inches wide. It was epic, but I didn't get it.
So I didn't get it because I thought the curved monitor might be like parabolic echoes for all
the work that we do here.
And I also didn't get it because, well, it's expensive,
and I don't know if I can get it into the resolutions I want for recordings
and things like that.
But here's somebody who posted a picture.
It says, develop in Java, be like.
And it's got, I think that's a 49-inch curved widescreen monitor.
Small font.
And it's edge-to-edge code.
There's no Pep 8 ideas on this, right?
Look at that.
Is that nuts?
That is nuts.
Yeah.
Yeah.
And the subtitles be like,
I heard you like getters.
Which apparently, you know,
no properties and all that.
Yeah.
But anyway,
I just thought you all might enjoy
just checking
out this picture of an insane bit of code like something's gone wrong when you need you actually
need the full width of a 49 inch monitor i was thinking of putting a couple windows side by side
i don't know i'm crazy i didn't measure mine i think mine's like i'll have to measure it. I think it's like 30 something.
I don't know.
But it's got a bit of a curve.
But the, I have to, it's painful to watch that.
And I'm not going to throw rocks at this glass house because I'm a C++ developer
and we've got a few pieces of gnarly code
that have big long lines.
Yeah, for the multiple
inheritance, multiple template
class.
Oh, yeah, and also just
bad naming sometimes.
That happens in Java, too. You've got big long
names. Well, the problem
is you've got to get a name something,
and then you've got to have a factory
something, and you've got to have an iFactory
interface of that something, and you've got to mock it out. Anyway, you've got to have an iFactory interface of that something.
And you've got to mock it out.
Anyway, it gets complicated and the names get long.
I understand.
And you have to get a mock factory and a name factory and a factory factory.
That's right.
Dave Pearson, the audience, has identified the coding style here as a PEP infinity instead of PEP 8.
That's PEP infinity code pep infinity yeah
well this was infinitely fun thank you brian and thanks everyone for being here
thank you i'll talk to you later bye