Somebody who knew Python asked me what an event loop was, and instead of rambling in a text box I decided to ramble in a video. I'm not sure why this is a popular video! I was answering one person't question and the video doesn't make much sense outside of this context. In this video we write a little chat client in Python that needs to use two different blocking calls concurrently: reading a line of user input and reading messages from a server. How can we do two "blocking" things (waiting for the user to type and waiting for messages to come in over the wire) at once? Should we switch to nonblocking apis for both of these, and just poll for each and switch between them really fast? No! Let's block on both of them at the same time with select! Then draw the rest of the owl and tada, an event loop!
Views: 3206 Thomas Ballinger
bpython is close to the 0.14 release. I'm going to look for bugs and fix them, and while I wait for bugs to crop up I'll prototype new features (this will be less exciting than it sounds). I'm trying out streaming because I find it useful to go meta and watch my process later. But you can watch too!
Views: 336 Thomas Ballinger
Skip to https://www.youtube.com/watch?v=1HS6oZRyzcc&t=408 when the audio starts! Want to know how to make your terminal battleship game have color output? Or how to find out the current width of your terminal? Or print a progress bar or spinner for your scraper? Of course you do!
Views: 1838 Thomas Ballinger
Skip to 14:35 when I actually get started: http://www.youtube.com/watch?v=jECXI8OQ0S4&t=14m35s We hit properties, descriptors, old- and new-style classes, mro, and other Python details while trying to implement safe attribute lookup for bpython autocompletion. I also try to write tests first, but have some trouble with this.
Views: 1225 Thomas Ballinger
An informal talk about how terminals work and how to harness their power for awesome
Views: 696 Thomas Ballinger
Let's work on https://github.com/thomasballinger/rlundo, undo for arbitrary command line interfaces (so long as they use readline). Tonight I'll work on restoring the terminal to its previous state after an undo. There'll be vt100 terminal emulation, tmux scripting, test-driven development, and lots of terminal layout work.
Views: 322 Thomas Ballinger