Anmelden

Python Bytes· Folge 499

#499 So many questions??

Mittwoch, 7. Oktober 2026 · 33 min

MP3

Shownotes

Topics covered in this episode:

• PEP 824 brings ?? and ??= to Python for None handling (peps.python.org/pep-0824?featured_on=pythonbytes)

• Python 3.15 (blog.python.org/2026/10/python-3150-rc3/?featu…) gets a surprise RC3, and Python 3.10 (blog.python.org/2026/10/python-31022-31117/?fe…) reaches end of life

• asyncio.shield (docs.python.org/3/library/asyncio-task.html#sh…)

• Pyxel: the retro game engine for Python (github.com/kitao/pyxel?featured_on=pythonbytes)

• Extras

• Joke

Watch on YouTube (youtube.com/watch?v=uXakV6i1-wc)

About the show

Sponsored by us! Support our work through:

• Our courses at Talk Python (training.talkpython.fm/?featured_on=pythonbytes)

• Consulting from Six Feet Up (sixfeetup.com/?featured_on=pythonbytes)

Connect with the hosts

• Michael: Mastodon (fosstodon.org/@mkennedy) / BlueSky (bsky.app/profile/mkennedy.codes?featured_on=py…) / X (x.com/mkennedy?featured_on=pythonbytes) / LinkedIn (linkedin.com/in/mkennedy/?featured_on=pythonby…)

• Calvin: Mastodon (sixfeetup.social/@calvin?featured_on=pythonbytes) / BlueSky (bsky.app/profile/calvinhp.com?featured_on=pyth…) / X (x.com/calvinhp?featured_on=pythonbytes) / LinkedIn (linkedin.com/in/calvinhp/?featured_on=pythonby…)

• Show: Mastodon (fosstodon.org/@pythonbytes) / BlueSky (bsky.app/profile/pythonbytes.fm) / X (x.com/PythonBytes?featured_on=pythonbytes)

Join us on YouTube at pythonbytes.fm/live (pythonbytes.fm/stream/live) to be part of the audience. Usually Tuesday at 7am PT. Older video versions available there too.

Finally, if you want an artisanal, hand-crafted digest of every week of the show notes in email form? Add your name and email to our friends of the show list (pythonbytes.fm/friends-of-the-show), we'll never share it.

Michael #1: PEP 824 brings ?? and ??= to Python for None handling (peps.python.org/pep-0824?featured_on=pythonbytes)

PEP 824, a new draft from Marc Mueller sponsored by Guido van Rossum, proposes None-coalescing operators for Python 3.16. The ?? operator returns its left-hand side unless that value is None, and ??= assigns a fallback only when the target is None. It revives the long-deferred PEP 505 (peps.python.org/pep-0505/?featured_on=pythonby…) from over a decade ago, trimmed to just these two operators, with None-aware access split off into PEP 823. The goal is replacing verbose is None checks with something closer to or, but keyed on None instead of truthiness.

• Every Python codebase has piles of if x is None fallback code, and this is the first serious move in ten years to give it real syntax.

• user.age ?? "unknown" is like or but only falls back on None, so 0, "", and [] pass through instead of getting clobbered

• user.name?featured_on=pythonbytes ??= "unknown" replaces the two-line check-then-assign pattern, with left-side subexpressions evaluated and cached exactly once

• Precedence sits between or and conditional expressions, matching JavaScript and C#, and ?? lands as a BoolOp in the AST next to and and or

• Unlike +=, ??= is a conditional assignment that skips the right side entirely, which is why it gets its own AST node rather than AugAssign

• Still draft status targeting 3.16, with a working reference implementation and an online demo to try, and it notably rejects a soft keyword like otherwise in favor of the familiar ??

• Discussion-worthy: the PEP answers the old objection that making None easier will proliferate its use, pointing out None is already everywhere and the status quo just produces uglier code

# OG way
user = db.get_user()
city = None
if user is not None:
if user.address is not None:
if user.address.city is not None:
city = user.address.city

# Michael's preferred way
user = db.get_user()
city = user?.address?.city

Calvin #2: Python 3.15 (blog.python.org/2026/10/python-3150-rc3/?featu…) gets a surprise RC3, and Python 3.10 (blog.python.org/2026/10/python-31022-31117/?fe…) reaches end of life

• The release team added a surprise third release candidate for Python 3.15 to fix last-minute lazy-import release blockers. They wanted time to test the fixes properly.

• That pushes the 3.15.0 final release from October 2 to October 9, 2026.

• RC3 has about 156 fixes from 82 contributors. The headline features are explicit lazy imports (PEP 810), the new frozendict (PEP 814) and sentinel (PEP 661) built-ins, and UTF-8 as the default encoding (PEP 686).

• No more ABI changes are coming, so library authors should be building 3.15 wheels now. uv 0.12.23 already added CPython 3.15.0rc3.

• On October 1, Python 3.10.22, 3.11.17, 3.12.15, 3.13.16 and 3.14.8 shipped together with nine common security fixes. They cover SSL validation, tarfile and zipfile handling, and urllib credentials.

• Python 3.10.22 is the final 3.10 release. After five years it gets no more security updates, so anyone still on 3.10 should upgrade.

• Python 3.13.16 is the last full maintenance release of 3.13, which now moves to security-only fixes. Only 3.13.16 and 3.14.8 have Windows and macOS installers, and the older releases are source-only.

• Python 3.11 gets security fixes through October 2027, and 3.12 through October 2028.

• A natural way to tie the two together: one version is nearly out the door and one is officially gone, and the same week is the time to test your code on 3.15 and move off 3.10.

Michael #3: asyncio.shield (docs.python.org/3/library/asyncio-task.html#sh…)

Where async code can be cancelled

In async Python, every await is a point where your coroutine can be stopped. If someone cancels the task, asyncio raises CancelledError at whichever await the coroutine is paused on, and nothing after that line runs.
Quart does this on purpose. When the client disconnects, it cancels the request's task. From quart/asgi.py:

elif message["type"] == "http.disconnect":
self._disconnected = True
request.body.disconnect()
request_task.cancel()

That's reasonable for a slow page nobody is waiting on anymore. It's a problem for a handler that writes to the database in two steps:

await downloads.insert_one(event) # 1. log the download
await totals.update_one(..., {'$inc': ...}) # 2. bump the episode's total

A podcast app requests the MP3, gets what it needs, and hangs up. If it hangs up while step 2 is in flight, step 1 has already landed and step 2 never runs. Nothing is logged and nothing reaches Sentry, because a cancelled request isn't an error. The two collections just drift apart.
Under WSGI this couldn't happen. A disconnect didn't stop your view; the view finished both writes and the server only failed later, when it tried to send the response.

The demo

I ran this on Python 3.14. The "client" hangs up 15 ms into a pair of 10 ms writes:

async def record_download():
await db_write('events')
await db_write('total')
_pending: set[asyncio.Task] = set()
async def record_download_shielded():
task = asyncio.create_task(record_download())
_pending.add(task)
task.add_done_callback(_pending.discard)
await asyncio.shield(task)
record_download events=1 total=0
record_download_shielded events=1 total=1

The unshielded version loses the increment. The shielded version finishes it, even though the request was cancelled. The full script is in the scratchpad as shield_demo.py if you want it for the show.

What asyncio.shield does, and its traps

shield(task) protects the inner task from a cancellation aimed at the outer one. The handler still gets CancelledError immediately, so nothing after that line runs, but the inner task keeps going until both writes finish. The traps:

• Keep a reference to the task. The event loop only holds weak references to tasks, …

Transkriptvom Podcast bereitgestellt · Zeitmarken springen hin

Calvin Hendryx-Parker Hello, and welcome to Python Bytes, where we deliver Python news and headlines directly to your earbuds. This is episode 499, recorded Monday, October 5th, 2026. I'm Calvin Hendryx-Parker.

Michael Kennedy And I'm Michael Kennedy.

Calvin Hendryx-Parker Glad to have you, Michael. Please support this show and all the sponsors. Make sure you support our work. Michael and I are doing lots of interesting things out in the community. So support the courses at talkpython.fm. So head over there. There's some really interesting new stuff, some Rust stuff, some web stuff.

Calvin Hendryx-Parker There's all kinds of data stuff. So check out Michael's courses online at talkpython.fm and check out the consulting from Six Feet Up. So I am co-founder and CTO of Six Feet Up. We are a Python AI shop who loves solving hard problems. So if you've got a hard problem and you'd love to talk about it, I'd love to talk to you about it.

Calvin Hendryx-Parker So let's move right along with connecting with us. you can find Michael and myself on Mastodon, Bluesky X, and LinkedIn. And the show is on Mastodon, Bluesky, and X. So check us out over there at Python Bytes. Join us on YouTube for pythonbytes.fm slash live to be part of the audience. You can actually participate live, ask questions. We may put them on the air and answer them in real time.

Calvin Hendryx-Parker Usually it's Tuesdays at 7 a.m. Pacific. Older versions are available there too. And finally, if you want an artisanal handcrafted digest of every week's episode show notes and email form put your email in the friends of the show and we will give you a beautiful email summary actually includes lots of little extras I kind of like that summary very meta but I like the meta-ness of it and we'll never share your email address so it's safe with Michael and I all right Michael uh I've got questions so many

Michael Kennedy questions question so many question marks so many so many question marks hey before we jump into the questions I just want to say I just came from a place with large buildings outside my hotel window and you have large buildings outside your hotel window.

Calvin Hendryx-Parker I do. I'm in New York City today.

Michael Kennedy That's awesome. Where were you, Michael? I was in San Francisco. I want to give a downtown San Francisco. I'm going to give a shout out to PiBay. That conference just happened two days ago and was tons of fun. And all the sessions were recorded. So they're going to be up. And I think it'll be really fun for everyone.

Michael Kennedy We'll give the videos a shout out when they're up. So that was really nice.

Calvin Hendryx-Parker Nice. PiBay's on my bucket list of conferences to attend. I've never been.

Michael Kennedy Well, it was fun, I can tell you.

Calvin Hendryx-Parker Nice.

Michael Kennedy But you have questions. you say questions there are question marks there questions there are questions now this topic is really interesting to me so there was a PEP 505 is this yeah 505 now often you'll hear this referred to as the idea is i'm dealing with variables that have no values and so you'll get like attribute errors because none type doesn't support whatever you're trying to do you know what i mean and so you got to check right is this thing not none then i can do thing with it right often these are referred to as null coalescing operators because like most programming languages call nothing for pointers null but by then we call it none so we have none coalescing operators so this was a proposal from

Michael Kennedy 10 years ago and it's revived as an idea for 3.16 by mark muller with sponsor none other than guido van rossom and the idea is let's go back to 505 from 10 years ago and just do like a really simple bit. Now I don't just have questions. I got, I got ideas. I have opinions. So, but let's, let's go with what it is first before I,

Calvin Hendryx-Parker I,

Michael Kennedy um, there was a lot of ideas in 505, 10 years ago for this one. It's very short and simple. There's two things, question mark, question mark is the operator. Hence the comment, the opening transition and question mark, question mark equal. So you got to scroll, scroll, scroll, scroll, scroll. Here it is.

Michael Kennedy It comes down to something than like this line age. If you're going to get a user, maybe you got the user from a database. This example is bad. Example in the, in the thing is not good because that's what is the type safety say about this? Can it be none? I have a user colon user, like lowercase user, uppercase user.

Michael Kennedy Python's type system says if something could ever, ever possibly be none, it must be marked as optional or, you know, type pipe, none, if you prefer the union variant of that. I don't like it, but you know what? I also have opinions there. So basically the way this thing is typed, it's literally not necessarily to check necessarily to use a null check, because if the type system is cohesive and you're running things like T Y or whatever, and they pass, then you would be good.

Michael Kennedy But the example is what it is. And so, so we take a user, but the user might be null or none, even though it says it can't be none. Um, it says, well, we're going to need to check. You might need to write if I'm up here, if you know, the user is itself not none, then, oh, wait, sorry. This is actually, so this is different.

Michael Kennedy So no, this is still fine. It says if user.age, trying to get the age from the user. So instead of saying if user is not none, if user.age is not none, well, just user.age is not none.

Calvin Hendryx-Parker Done that so many times in my life. Other,

Michael Kennedy yes, I know. Other, otherwise, if I got a user and it has no age set, then instead of saying I have an if statement where I set the value, I can say question mark, question mark, unknown age. Okay. I'm not, I'm not against this. my opinions are not saying this is bad. It doesn't seem to buy me very much, right?

Michael Kennedy I mean, you could say user.age if user.age is, you know, else unknown or whatever. Like it's, you can still kind of one line it in not much more effort. You don't, as a ternary sort of expression or something.

Calvin Hendryx-Parker Yeah, I was thinking like ternary would be appropriate.

Michael Kennedy Yeah, that's how you would have done it before if you wanted one line. But, you know, it's fine. I think it's, I think it's okay. Now, if we go back to 505 from 10 years ago, there's other things as well, like question mark dot. And now this one I think is actually, if they're going to pick one thing in the language and use, and like, so we're going to add a little bit of null or none help here.

Michael Kennedy This one is the one that makes such a difference. So in the show notes, I put a little example, um, down here where you'd have to do it the old way or you have to do it the new way. And this little example here lost my comments, but the comments are in the show notes. So I go to the database I get a user, I may or may not be logged in.

Michael Kennedy So this could be, could be a user object or it could be none right. And I have a city, I want to set the city to a value. But if I don't set it to a value, I want the city to be none. So I have to say, if user is not none, then I can run the test if user.address is not none, then I can run the test. If user.address.city is not none, then say it equals user.address.city and I mean like this, this is a lot.

Calvin Hendryx-Parker Yeah.

Michael Kennedy What was in the original one and what I wish was here, if they could add one more thing, just one little bit would be this one line here. City equals user question mark dot address question mark dot city.

Calvin Hendryx-Parker I can see why this is controversial.

Michael Kennedy Is it, you have opinions now? So the way this works, the way this works in other languages is when you, instead of saying dot for attribute access or function calls or whatever, you say question mark dot. And if the thing that you're trying to do attribute access on itself is none, so like user question mark dot.

Michael Kennedy So if user is none, then you just short circuit and return none. If user is not none, but user address is none, you short circuit that and you return none. Otherwise, you just give the value of city, none or not.

Calvin Hendryx-Parker A little opaque for me. A little.

Michael Kennedy Okay.

Calvin Hendryx-Parker Yeah. I mean, I agree that the verboseness of the example given there is a lot of what feels like boilerplate to get the same thing done. So I can understand why they didn't go all the way for this version of this index.

Michael Kennedy Yes. So to be...

Calvin Hendryx-Parker I mean, if you thought the walrus was contentious.

Michael Kennedy I know, it's true. The walrus has left scars. But here's the thing. So how much does this, I don't know, how much does this new addition here help, right? This user.age? ?unknown. You know, how do you solve problems? It doesn't really solve problems like that one. It just compresses ternary expressions, right?

Michael Kennedy it doesn't actually alleviate the none checking. Like if you wanted to check is user none or age none.

Calvin Hendryx-Parker Yeah, but maybe I don't I don't see.

Michael Kennedy Yeah, I don't see any way to

Calvin Hendryx-Parker this feels cleaner for the ternary version of that.

Michael Kennedy Yeah,

Calvin Hendryx-Parker yeah, let's see. We got some again, this is this is personal opinions. I think both of us are

Michael Kennedy absolutely I'm okay without it. But if you're gonna add no operator, like no operations to the language, The biggest one is the if this is not, if this is like just the sawtooth of four things, ifs. Kiva out there says, when I went from C# to Python, I really, really missed the null coalescing operators more than anything else, even the type system.

Calvin Hendryx-Parker Yeah.

Michael Kennedy Yeah, yeah, yeah.

Calvin Hendryx-Parker But like you just mentioned with the sawtoothing, the flat is better than nested Python, you know, to tenant. Really, I believe in that one. And that breaks it when you go that deep like that.

Michael Kennedy Yeah. Yeah. So you would, I mean, what would I do? All right. We're in the danger of going too deep. So what I would do is I would use for this, this, like the way it has to work now, not Michael's beaver dream of null checking. You've got to use what are called guarding clauses, right? You say, if user is none, return, return something like none or whatever.

Michael Kennedy And then if user.address is none, return something else. And then finally you can get the city and you know, you can flatten it with the right patterns.

Calvin Hendryx-Parker That's the Vincent of Python pattern I would have used.

Michael Kennedy Yeah. All right. That's enough for this. People, this is a proposal, a draft for 3.6. We have had opinions and we've shared them and now you can have yours. Over to you, Calvin.

Calvin Hendryx-Parker Yep. Well, speaking of language features and new versions that are out. So we've been talking about Python 3.15 for at least the last month of episodes, hoping it would have been out October 1st, but that got moved. So we actually have got Python 315 RC3 that came out this week. So if you are keeping track, you should probably notice that there's not been a formal release, but it will be coming.

Calvin Hendryx-Parker I believe they're saying final is scheduled here for the ninth. So before the next episode, we will have Python 315 that is out. The showstopper roadblock that was going on in there was basically some support or fix for what was lazy import release blockers. So the kind of one of the really nice new features of Python 3.15 that you probably should check out.

Calvin Hendryx-Parker And if you wanted to go use what's newt to do a dungeon crawler and explore those features. But the lazy imports had a last minute bug. So they want to make sure they get the fixes tested properly. So if you aren't familiar again, lazy imports means that you can say lazy import from blah, blah, blah, blah, blah.

Calvin Hendryx-Parker And when you go to use it is actually when it'll import at that point in time. So you could actually have imports at the top that actually never get imported based on conditions, which might actually be preferable given your stance on memory usage or loading things for security reasons or lots of other things that could be basically be wrapped into that.

Michael Kennedy I'm very excited about the lazy imports.

Calvin Hendryx-Parker Yeah, I am too. So I think the lazy imports and then the frozendicts that we get now as well. I think that's the other major one that was going in there. But there's no major ABI changes for this RC. It's just making sure dotting the I's and crossing the T's and making sure that the version 3.15 is very, very solid.

Calvin Hendryx-Parker So that's part of the news I wanted to cover on this one. The other piece that I wanted to cover was that on October 1st, they also released the last version of 3.10. So if you see right here, Python 3.10, .22, 11, da, da, da, da, da, all the minor releases there for 10 through 14 are now available. The most important piece I think of this release that I wanted to bring it up during this segment was there'll be no more releases of Python 3.10.

Calvin Hendryx-Parker This is the EOL final end of line. There'll be no more security releases for 3.10. So if you've got code in production that is running 3.10, you've been warned, you've been told probably many, many, many, many times, along the way that this is coming, but it's become, we're here. So for example, there was nine common security fixes in this October 1st release.

Calvin Hendryx-Parker There was things like SSL validation, that tar file and zip file handling, URL lib credentials. Those all sound pretty important. And those are the kinds of things you're going to want to have fixes for inside your code, especially given the state of credentials. AI and all the things that are kind of coming out after it.

Calvin Hendryx-Parker So it's been five years. It's time-free to upgrade. There's going to be no more 3.10.

Michael Kennedy That's wild because I'll tell you that 3.10 sounds pretty modern to me.

Calvin Hendryx-Parker Same for me. I mean, I think we are of an age and have been in the Python community long enough that five years passes before your eyes, before you know it. But 3.15 is about to become very much a reality. 3.14 is very stable. 3.11 has all the things you probably want and probably is most likely a drop in.

Calvin Hendryx-Parker These releases of Python, I don't believe there's been too many backward compatible breaking changes in there. So there's not really much of a reason not to. If you've got great test suites and you can go and do a Nox style test against all of them, find out which one doesn't break for you quickly through your CI pipeline and get your code updated for the latest versions of Python.

Calvin Hendryx-Parker Now that said, Python 3.11 will get security fixes through October of 2027. So you got another year on 11 and another year after that for 12. But why not just go to the 315? It'll be out later this week.

Michael Kennedy If you're already doing the work,

Calvin Hendryx-Parker you might as well get yourself another five year lease on this work.

Michael Kennedy Run Knox, run all of them. Run all of them. See if they all pass or if there's issues and either fix or just go back to the, you know, 313 or whatever that works. Yeah.

Calvin Hendryx-Parker I just, again, I hate, I put this one here because I really do not want to see anyone be a headline on Hacker News or any other major news outlet, I've got an extra that's kind of related to this, that you shouldn't, don't be a victim. Keep up to date. Python is very, the Python community is very good about compatibility, updating, having updating notes.

Calvin Hendryx-Parker We learned a lot of lessons in the two to three history of Python. So go out there and get yourself upgraded. But Michael, that's what I got for.

Michael Kennedy One of those lessons was waiting for a very long time for the world to sort itself out. It doesn't necessarily treat you that well.

Calvin Hendryx-Parker Yeah, that's true.

Michael Kennedy Maybe stay on top of things as they're changing rather than like waiting eight years to go, oh gosh, we got to upgrade. Like you should have a shield. Let me just put up like a shield sort of thing.

Calvin Hendryx-Parker Is there a shield people could use?

Michael Kennedy There is a shield people can use and I've got details for you. So I've been experimenting with ideas, some crazy ideas and I'm not ready to share with you. Well, I might share with you privately, of course, Calvin, But I'm not ready to share with you, dear listeners as a broad world until I have more info on it.

Michael Kennedy But it's pretty wild. So I've been doing a lot of testing on like different database type systems and so on a couple of the websites. And I have this place where I write basically an analytics entry. You know, someone's downloaded this or they watched a video or something like that. And then I increment it somewhere else because, you know, 50 million records, you don't want that to be operational.

Michael Kennedy Like who has done this thing? You might want it like a little more concise or how many people downloaded that thing or whatever. So it writes it once to this kind of summary table that the websites use. And then it writes this, this analytics one. Well, it turned out that out of many, many millions, there was 1,200 missing entries, where, where did they go?

Michael Kennedy It says right here. And then it says right there. Well, these came into existence once I switched to an async web framework court, but it could be FastAPI. It could be Litestar. It's not anything necessarily specific with court, not necessarily. So what happens is with court, if somebody makes a request and the request is in flight and they decide they're not doing that anymore, or they're going to cancel that, or they're going to go somewhere else, court itself does a request.cancel.

Michael Kennedy So it says, oh, did somebody disconnect? Like here's the LF literally says disconnected, request body disconnect. And the last thing is request task.cancel in the court ASCII.py file. Well, what happens is if you're writing one event and you're awaiting it and you're writing another event and you're awaiting it, if this first one has not, has finished, but it hasn't quite gotten done, it hasn't finished awaiting.

Michael Kennedy Well, this thing just raises a task canceled exception and that one doesn't run. Or maybe this one's starting, the second one is starting to do a database negotiation. Like, hey, give me something on the connection pool and I'm going to start talking. I'm out. And so these don't have to happen atomically.

Michael Kennedy Right. So there's different things you can do to do that. Obviously you could use a transaction, but then you would lose the first one, which maybe like a request did come in. Maybe you want to save them both, right? So what are you going to do? You can bust out the asyncio dot shield and this, I've done a lot of asyncio stuff.

Michael Kennedy And this is surprising to me. So what you can actually do is with this asyncio shield, it basically says this sub, this async subroutine. I do not want it. Even if the outer task gets canceled, I want this to either not run or completely run, right? So I can do like record download. I can say await. Instead of wait, just the task, I await asyncio shielding the task and you get consistent.

Calvin Hendryx-Parker Yeah, you get more intentional control over the specific use case because that can happen in your, like you said, your left scratch in your head.

Michael Kennedy Why? It doesn't make any sense. Like it's either running or it's not running. Well, apparently the web framework unwinds it partway through, which is reasonable so that they can go handle requests that are not disconnected.

Calvin Hendryx-Parker I mean, it's more than reasonable. It cleans up after itself 'cause it allows you then to perform other cleanup operations that may have happened along the way too.

Michael Kennedy Yeah, exactly. So this is not a third party thing. This is just built into the asyncio module. But to me, this was a mystery until I learned about it.

Calvin Hendryx-Parker Yeah, I've never explored this before. This is really cool.

Michael Kennedy Yeah, yeah. And the other thing that's really noteworthy here is you need to make sure that you have something holding onto the task, right? So here you can see the task is created And then it adds it to the pending tasks. Because I remember where I wrote about this. Let's see. Fire and forget. Not ever, never.

Michael Kennedy So both I wrote about this and Will McGugan wrote about this. But it turns out that if you start a task and you don't hold on to a reference to it, the asyncio event loop uses weak references. So it's very likely that once you create a task and start it, If you don't hang on to it, there might be a garbage collection or some sort of reference kind of thing that just drops it halfway through.

Michael Kennedy So kind of got to keep this in mind plus that. So it's a little, not super obvious. Like, so that's what this pending task thing is about. Anyway, it doesn't solve all your problems. Like you've got to keep a reference to the task. Errors go nowhere by default, because now you've, you basically said the outer thing that called it, I don't want it to see that anymore.

Michael Kennedy Don't worry about it. Doesn't survive shut down. If something hangs while you told it, it can't cancel. so it's not going to cancel if you keep going and um it'll make him both finish but it's not necessarily atomic right if there's an exception that's different than just avoiding cancellation

Calvin Hendryx-Parker so anyway i feel like you solved one one interesting edge case you've only solved one interesting edge case but potentially introduced like six more in the traps and current traps and

Michael Kennedy be careful i'm tired of it i don't want to do any more let's just go play games you want to play

Calvin Hendryx-Parker games yeah okay let's play some games this is a so this is not a new framework necessarily but it's been getting a lot of uh exposure recently on the interwebs and so it's called pixel it is a retro game engine for python it's a free mit licensed game engine that you use python to build games in uh what kind of attracted to me is i am obviously a fan of the retro looking game aesthetic So it's kind of like how Twitter used to deliberately limit you to 140 characters.

Calvin Hendryx-Parker This deliberately limits you to 16 colors and four sound channels. So you are basically operating in the world of classic game consoles like the NES and so on. So it keeps the scope small. And one of their goals was to make the games finishable as a programmer, not as the player, but as the person building the game.

Calvin Hendryx-Parker So you're not getting, you don't get into me the traps of all the features and all the 3D and all the other kind of things. It's been in development since 2018. It's got 18,000 GitHub stars on there. It has built-in editors for the pixel art, which is also something I, is near and dear to my heart, which is like the art and the aesthetic behind the game.

Calvin Hendryx-Parker So you can build art and the tile maps. It's got editors for the sound and the music. So you can make graphics, audio, and the game logic in one place. So again, not to get distracted by going to five other tools to get something done. That's a great way to do all that stuff in one tight place for that.

Calvin Hendryx-Parker What's awesome is that actually the engine behind the scenes is implemented in Rust. And so we've been hearing a lot about Rust lately. It gets compiled into WebAssembly, which you can launch the games locally on your computer, compiles down into a locally executable Rust binary. But you can also play the games on your web browser.

Calvin Hendryx-Parker So it uses WebAssembly to deploy these or make them deployable into your web browser. So the CodeMaker has a browser playground with the code editor and all the tools built into it. You can load programs from local files, GitHub Gists or URLs. Actually, I'll show you a quick demo of this right here. So in the showcase, you can just run uvx pixel copy examples, and it will pull these examples to your local computer where you can run them.

Calvin Hendryx-Parker or you can just go into the docs over here and they've got the pixel showcase where these are the exact same examples from that copy examples I was running locally on my machine. These will run here. I'm going to run one. I'll run the platformer. It's kind of fun. This is WebAssembly. This Python code compiled to run in my browser.

Calvin Hendryx-Parker And so you can see here, it's got sound a whole bit. You can't obviously hear the sound, I think because I didn't share it over there.

Michael Kennedy That's so cool.

Calvin Hendryx-Parker Boom, there you die. So it's fun.

Michael Kennedy You know what we got to do? Did you ever play the game Lemming?

Calvin Hendryx-Parker Yes.

Michael Kennedy Oh my God. That's one of the best games of the genre in my opinion. And it has to come back.

Calvin Hendryx-Parker Yeah. Let's see if I can find my mouse again.

Michael Kennedy Wasn't the original Prince of Persia a little like this as well? Very original. Yeah. These are good.

Calvin Hendryx-Parker Yeah. They got some nice, interesting examples. And then there's a whole like gallery of examples on the site for pixel as well. If you come down here and you can see these a bunch of examples that run. They're cross-platform, obviously. They run Windows, Mac, Linux, Web. They don't care. They run everywhere.

Calvin Hendryx-Parker It's great for, like, if you want to teach people how to code and program, some of the most popular sessions we've ever done in our IndyPy user group have always been like the arcade library or the PyGaming libraries, because people can relate to and know that if they can build games like this, they can learn how to program and do really, really cool stuff.

Calvin Hendryx-Parker It's a fun low barrier way into game development. Good for beginners, good for teaching kids again, because it all runs in one spot. You're not having them install a bazillion different things. Actually, I think if we go. Yeah, here we go. I've got the examples over here. You just run like that. That's the same platformer.

Calvin Hendryx-Parker And it launched a rich looking app right on my desktop.

Michael Kennedy Yeah, that's awesome.

Calvin Hendryx-Parker Let's see if I can get right. I can't. Oh, there we go. I'll get a little further.

Michael Kennedy Oh, you know what reminds me of? I was going to say Flappy Bird, but that's not what it is. It reminds me of Joust, but bird form.

Calvin Hendryx-Parker But you can even come in here and run like the hello world. Oops, not 1.py. Let's say there's like the 01, obviously. And then this one's just like the hello world of pixel. Hello, pixel.

Michael Kennedy And there's a link tag.

Calvin Hendryx-Parker Yeah, yeah, yeah. And so if we just bat the 01 hello, you can see here 20 lines of Python code that run on the Rust engine using pixel.

Michael Kennedy Yeah.

Calvin Hendryx-Parker So super fun, very easy way to get started and go run some cool Python code.

Michael Kennedy I love it.

Calvin Hendryx-Parker Yeah.

Michael Kennedy Very fun.

Calvin Hendryx-Parker It was very fun. I don't know if you've got any extras, Michael, you wanted to cover real quick?

Michael Kennedy I got a couple, actually. Let's jump in here. So where do we want to go? These are both pretty small. So first of all, we're back from Stefan on Tiny Mongo.

Calvin Hendryx-Parker This Mongo one's got a lot of legs.

Michael Kennedy It's got legs. Well, because we worked for weeks on getting this thing almost performance compatible and API compatible with MongoDB a sequel light rapper it was incredible so we talked about it on the podcast last week and he's like i loved it so much i gave you guys a little bit of shout out so here check this two things one nice little shout out to watch you and me debate it from or to discuss it last time but also this this click here to like give you something help me use tiny mongo here's the thing that it had it on right you just copy this give it to your ai coding agent this gets started by copying a prompt give it to your AI coding agent and let them get you going using tiny mongos.

Michael Kennedy Pretty sweet.

Calvin Hendryx-Parker I like the way to bootstrap people into success.

Michael Kennedy Yes, I do too.

Calvin Hendryx-Parker Because otherwise you're kind of stuck with the blank sheet of paper syndrome, like where you're just like, oh, it's a big blank sheet. I don't know what to do. Here you go. Get started.

Michael Kennedy Exactly.

Calvin Hendryx-Parker You get to go.

Michael Kennedy Yeah, you get to go. Then the other one is I've become kind of fascinated with Lightstream. Are you familiar with Lightstream?

Calvin Hendryx-Parker Lightstream. I don't know if I've ever used Lightstream. No.

Michael Kennedy So it's super interesting. There's this video that I'm going to link to called Lightstream plus SQLite. Scale to a million users without Postgres or CloudBills. And this video, this guy puts this together. Let me see if I can get it to skip ahead. But there's really cool animated sort of architectural tech talks, usually like 10 minutes.

Michael Kennedy This guy's called Claude Codes. Now, it's AI text-to-speech generated. I don't know that it's AI generated, but it is. I think a person's behind it, but I think it's spoken by an AI. So it says Litstream, even though it's not pronounced that way, I don't believe. That said, I'm recommending it anyway because it's so good.

Michael Kennedy This is such an interesting topic. So Lightstream is a thing that you can put next to any app that runs on SQLite. If you turn on the write-ahead log wall mode, which is the durability mode of SQLite anyway, if you turn that on and you run Lightstream next to it, it will take the write-ahead log and it will stream it to somewhere like S3 or anywhere else.

Michael Kennedy And the way it works is it will eventually compact those. So instead of just having a bunch of write logs, it'll say, okay, it's been, I don't know, an hour. So I'm going to take all of those and like merge them into a SQLite file and then some more and some more. So you get within a few seconds of my SQLite file is now backed up somewhere else.

Michael Kennedy And if for whatever reason it fails, you know, I could just restore it in reverse, which is pretty interesting.

Calvin Hendryx-Parker That's really cool.

Michael Kennedy Yeah. So they talk about some other projects like, Expensify does something like 4 million rights a second on SQL light or something like an incredible thing they set up. So why do I bring this up? What does this have to do with an extra? Why is it not a topic? I'm trying to do an episode with somebody from light stream.

Michael Kennedy I reached out to the creator, Ben, who has, um, just completely ghosted me. I sent him like three or four different channels of messages, not interested.

Calvin Hendryx-Parker This is a plea for help.

Michael Kennedy So my, it is a plea to like, Hey, If someone out there is doing cool stuff with Lightstream and SQLite embedded data and wants to come on Talk Python and talk about it, shoot me a message and maybe we'll make that happen. My traditional channels have run dry.

Calvin Hendryx-Parker All right. You heard the man.

Michael Kennedy It's a plea.

Calvin Hendryx-Parker If you'd like to do that, come on down. I got a couple quick extras. One of them I didn't make a segment as part of my Python language bits, which was there's a new namespace potentially coming to Python called Sys. So if you have ever made a file in your directory that conflicted with the name of a standard library module, you may have experienced this bug.

Calvin Hendryx-Parker So you can see here that if you cat the game.py, it imports random. And then it uses random.randint to pick an integer between 1 and 10 here. And if you run the game, you'll see module random has no attribute randint. How is that possible? It's because you've got a module in your syspath someplace that is shadowing it.

Calvin Hendryx-Parker So instead, correction, I wasn't talking about a sys namespace. This is now the standard namespace, which could be, for example, import std.json. And now you are certainly very explicitly using the JSON library that comes with Python explicitly. So this was discussed, seemed to be met with lots of enthusiasm and people who are very excited.

Calvin Hendryx-Parker I'll go just scrolling down here to the very end, that it was many attendees loved the idea. No one attending hated the idea. So I'll call that a, that was a resounding success for this one. We'll see the, there'll be a PEP probably coming soon to get this included. So I don't expect this soon, but I think this is on the horizon.

Calvin Hendryx-Parker Lots of other languages have this. I think they mentioned in here. So we've got Rust, Java, Go, Node, all have something similar to make this explicit and safe. So Python was the holdout on this, which is kind of funny given our love of explicitness that we would not have this level of care there.

Michael Kennedy There should be one and preferably only one way to do a thing unless there's six ways to do a thing.

Calvin Hendryx-Parker Correct. The last extra, be careful out there, folks. If you have a refrigerator that is smart and you need to upgrade it or update the firmware, some Samsung owners have reported that the firmware update bricked not only their Samsung smart part of the fridge, but the refrigerator itself. They had spoiled food after firmware updates bricked their Samsung smart refrigerators. This appeared to only have happened in Korea.

Calvin Hendryx-Parker So this seems to be kind of limited to an early release. Samsung did respond to Ars Technica on this article saying that they had a response in their user complaints forum. This is just a translation, but they're doing their best to ensure that customers do not suffer any losses during this specific holiday period in Korea.

Calvin Hendryx-Parker So be careful out there, folks. Your refrigerator could get bricked. And I'm just shocked that this did not have a fail safe to go back to being just a standard refrigerator after the smartness wore off. It seems like a natural state to fail into. You know, kind of like an escalator. When an escalator is broken, it's just stairs.

Calvin Hendryx-Parker You know, it still works.

Michael Kennedy Instead of being the ride where you free fall for three stories.

Calvin Hendryx-Parker Right.

Michael Kennedy That's crazy.

Calvin Hendryx-Parker Yeah, so be careful. yeah yeah all right michael if you have do you have a joke for us this week i do have a joke

Michael Kennedy all right let's i'm always down for jokes so this one comes to us from uh will vincent he doesn't he didn't send it in i just found him saying something funny and it's the joke so the title

Calvin Hendryx-Parker of the joke makes me think of an lcd sound system song okay you should be thinking perhaps lord of

Michael Kennedy the rings lord of the rings something like that okay that's a different direction okay so well here we go so will vincent says today i was talking with a colleague about how difficult python installation and packaging was before uv and there's whatever the elf from lord of the rings like forgot the name character name but i was there gandalf i was there 3 000 years ago we didn't even have pip we called it the cheese shop eventually it was brutal i was there gandalf

Calvin Hendryx-Parker how appropriate that they would pick 3 000 years given that python always guido always referred to Python 3 as Python 3K in the early days. A lot of intersections going on here for that joke.

Michael Kennedy Yeah, pretty funny, right?

Calvin Hendryx-Parker But I was there back in the day. It is related to the song a little bit.

Michael Kennedy Okay. I don't know the song. I'm going to have to be educated later.

Calvin Hendryx-Parker I'll put a show note to it, maybe.

Michael Kennedy Sweet.

Calvin Hendryx-Parker Nice. Well, thanks, Michael, for joining me for this week's episode. And hopefully we'll connect again next week.

Michael Kennedy I would like to actually add something for people listening really quick. Because next week, what episode is it? 500 it's special we're going to do a little bit something special for next week we're going to have brian auken is going to be back on the show as a guest first time ever actually and we're going to have some other folks also join in on the show and kind of just do a little bit of an extended version a little bit special with some other folks so try to come and be a part of it if you really care and want to yeah it's not going to be at a normal time but if you look on youtube for the upcoming version live stream.

Michael Kennedy It is at the time. So I believe that's noon Pacific on Tuesday, the 13th.

Calvin Hendryx-Parker Yeah. Join live. You won't miss the special guests.

Michael Kennedy Exactly. Exactly. All right. Well, we will be there as always.

Calvin Hendryx-Parker Sounds good. See you then.

Anmelden oder registrieren

Jetzt

0:00 / 0:00