Asyncio part 2 - Now More Abstract

Posted on Wed 08 August 2018 in Posts • Tagged with python, pythonTipOfTheDay, asyncio, coroutine, abstract, abc, asyncawait

What happens when you mix coroutines with Abstract Base Classes?


Continue reading

Asyncio, You are a complex beast...

Posted on Sun 05 August 2018 in Posts • Tagged with asyncio, python, pythonTipOfTheDay, asyncawait

Learning asyncio


Continue reading

Python Tip of the Day - Merging Dicts

Posted on Fri 03 August 2018 in Posts • Tagged with python, pythonTipOfTheDay

Python Tip of the Day - Merging Two Dicts


Continue reading

F-Strings Are F'ing Cool

Posted on Thu 12 July 2018 in Posts • Tagged with python, pythonTipOfTheDay, fstrings

Python 3.6 introduced a new way to format strings. They're really f-ing cool. Let's see why.


Continue reading

Python Tip of the Day - Simple HTTP Server

Posted on Tue 17 April 2018 in Posts • Tagged with pythonTipOfTheDay, python

Using Python's Simple HTTP Server for fun and profit (and quickly sharing files)


Continue reading

Python Tip of the Day - Double If's in Comprehensions

Posted on Wed 11 April 2018 in Posts • Tagged with pythonTipOfTheDay, python

So I was reviewing a coworkers pull request today and saw something I hadn't seen in Python before. As it turns out you can have multiple if clauses on a list comprehension. For example:

>>> [v for v in range(50) if v % 2 == 0 if v > 10]  # all even numbers …

Continue reading

Python Tip of the Day - Logging basicConfig

Posted on Wed 14 February 2018 in Posts • Tagged with pythonTipOfTheDay, logging, python

Oftentimes you just want to try out something related to logging in the REPL, or in a hacky script.  Wading through the docs on the logging module is this painful exercise in reading about handlers and formatters and other stuff you don't care about.

The simplest way to just get …


Continue reading

Python Tip of the Day - subTest!

Posted on Sat 23 September 2017 in Posts • Tagged with pythonTipOfTheDay, testing, unittest, python

Coming from a jUnit background, one of the things I always missed with the vanilla Python unitttest library was parameterized tests.  Oftentimes when writing unit tests for a particular unit you find yourself writing effectively the same test over and over again, but with different inputs. Wouldn't it be nice …


Continue reading

Handy Python tip #1

Posted on Thu 07 June 2012 in Posts • Tagged with pythonTipOfTheDay, python

The other day I was adding the rich comparison methods (the ones for operator overloading) to a class I had defined. Like many Python programmers before me I wondered "why is it that if I define a method for equality, I still have to define a not-equal method?" and "if …


Continue reading

Useful Python Tools

Posted on Fri 18 May 2012 in Posts • Tagged with pythonTipOfTheDay, python, nose, metrics, quality, testing

I often stumble across and use a number of useful tools for creating Python code. Thought I'd barf out a blog post documenting a few of them so that my future self will be able to find this info again if need be. :)

coverage.py

(http://nedbatchelder.com/code/coverage …


Continue reading