Skip to content
0:00 / 0:00

#trio#asyncio#structuredconcurrency

Nathaniel J. Smith - Trio: Async concurrency for mere mortals - PyCon 2018

PyCon 2018

22K subscribers • 3 videos on Hallway

YouTube
  • Recommended by 2 people: 2 on Hacker News.
  • Presented by Nathaniel J. Smith, creator of Trio
  • Linked in the descriptionPyCon/2018-slides

Intermediate. Assumes working knowledge.

29K views8 years ago2 recommendations

Programming languagesSoftware designPythonConcurrency and parallelismDesign patterns

Nathaniel J. Smith introduces the Trio library and explains how structured concurrency makes writing concurrent Python programs simpler and safer.

Speaker: Nathaniel J. Smith Concurrent programs are super useful: think of web apps juggling lots of simultaneous downloads and websocket connections, chat bots tracking multiple concurrent conversations, or web spiders fetching pages in parallel. But *writing* concurrent programs is complicated, intimidating to newcomers, and often challenging even for experts. Does it have to be? Python is famous for being simple and straightforward; can Python make concurrent programming simple and straightforward too? I think so. By carefully analyzing usability pitfalls in other libraries, and taking advantage of new Python 3 features, I've come up with a new set of primitives that make it dramatically easier to write correct concurrent programs, and implemented them in a new library called [Trio](trio.readthedocs.io). In this talk, I'll describe these primitives, and demonstrate how to use them to implement a basic algorithm for speeding up TCP connections. Compared to the best previous Python implementation, our version turns out to be easier to understand, more correct, and dramatically shorter. This talk assumes basic familiarity with Python, but does *not* require any prior experience with concurrency, async/await, or networking. Slides can be found at: speakerdeck.com/pycon2018 and github.com/PyCon/2018-slides

Why it's here

2 people recommend this

What people say. Highly recommended as one of the best explanations of the pitfalls of asyncio and the benefits of structured concurrency.

acidbaseextracton Hacker News • Recommends

On “A viable solution for Python concurrency”

The video (or blog post) below is one of the best explanations I've seen about what subtle bugs are easy to make with asyncio, why it's easy to make them, and how the trio library addresses them. But yes, consider alternatives before you pick asyncio as your approach! Talk: link to this video Blog post: link

kzuberion Hacker News • Recommends

On “Structured Concurrency Definition”

A useful introduction to the ideas is in Nathaniel's PyCon 2018 talk on trio 1, where he live-codes a solution to a concurrency-spaghetti problem. 1 link to this video

ric2bon Hacker News • Mentions

On “Don't trust default timeouts”

Great list. That last suggestion (Multiple requests) can be tough to implement correctly, I think it's usually called Happy Eyeballs: link to this video