Dave Behnke

Generalist and Tech Enthusiast

Python Pep-0492 and AsyncIO

programming python

Summary AsyncIO was introduced with Python 3.4. A new syntax was proposed and approved for Python 3.5 with PEP-0492 (https://www.python.org/dev/peps/pep-0492/) As a followup to my previous article (http://davebehnke.com/posts/python-asyncio-streams-client-server/), I show how to write my AsyncIO example using python 3.5. Python 3.4 Here is a snippet in Python 3.4. @asyncio.coroutine def myfunction(host, port): client_reader, client_writer = yield from asyncio.open_connection(host, port) try: data = yield from asyncio.wait_for(client_reader.readline(), timeout=10.0) finally: client_writer.close() Python 3.5 Here is how it can be written in Python 3.5.

31 May 2015 #python #asyncio #pep-0492 #python 3.5

Moving on to Hugo

journal golang

I’ve decided to move my site to Hugo. http://gohugo.io Previously I was using Pelican http://blog.getpelican.com/ to generate my site. The reasons are mostly personal perference and not because Pelican is a bad tool. I’m only moving the popular articles from my pelican version. Hopefully this change means I’ll be posting more :)

30 May 2015 #hugo #golang

Python AsyncIO - Streams - Client and Server

programming python

Summary AsyncIO is the new hot topic for Python 3.4 which was just recently released. In my opinion, AsyncIO is a big game changer for Python. Where it makes sense, many libraries are sure to port some or all of their code to take advantage of it. I’m going to show you my version of a client and server I wrote after digesting section 18.5 of the Python documentation and looking at a few examples on the web.

18 Mar 2014 #python #asyncio