1. Using asynchronous for loops in Python

    asyncio has brought support for asynchronous I/O with an event loop to Python 3. Since Python 3.5, we can use the async and await keywords:

    async def get(self):
        await self.wait_for_token()
        return self.client.get()
    

    But Python 3.5 also brought support for asynchronous context managers (async …

    read more

    There are comments.

  2. Indenting JSON in Python

    Main JSON railroad diagram - http://www.json.org/fatfree.html

    At work, I recently wanted to visualize how we annotated documents that we store as JSON in Elasticsearch. We annotate substrings with different codes, and I wanted to show those codes using colors in a terminal. This basically boils down to outputting JSON with ANSI escape codes. The easier part …

    read more

    There are comments.