Code Refactor of the Day - Extracting Compound Conditionals

Posted on Mon 15 January 2018 in Posts • Tagged with codeRefactorOfTheDay, refactoring, quality, python

I'm currently doing the 30-Day Code Quality Challenge (https://www.codequalitychallenge.com), and today's exercise was an interesting one -- extract a compound conditional.

The idea of extracting a compound conditional is it's a refactor to try and improve the readability of code by giving a name to a complex boolean …


Continue reading

Python and Microsoft?

Posted on Wed 03 January 2018 in Posts • Tagged with python, news, microsoft

Much has been said about how Microsoft has changed in recent years, no longer the super closed-source monopolistic giant it once was.  Regardless of whether or not you believe the change is real or just at the surface, permanent or temporary, etc, there is definitely some interesting things that have …


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

Serverless Microservices and Python (with tests!) - Part 2

Posted on Fri 28 July 2017 in Posts • Tagged with lambda, serverless, microservices, aws, python

Ok, so in part 1 of this series, I started off by exploring the use of Lambda and API Gateway as a tool for building scalable microservices in Python. I largely focussed on taking an existing tutorial, and building out some unit tests for it, as well as some supplementary …


Continue reading

Serverless Microservices and Python (with tests!) - Part 1

Posted on Thu 27 July 2017 in Posts • Tagged with lambda, serverless, microservices, aws, python, testing

So I'm currently on holiday and also between jobs (had my last day at old job last week, and first day at new gig is next week), which means of course what am I doing but spending some time learning some tech that's fun & buzzwordy.

Right now it seems like …


Continue reading

Git bisect And Nose -- Or how to find out who to blame for breaking the build.

Posted on Fri 03 August 2012 in Posts • Tagged with git, nose, python, testing

How did I not ever discover git bisect before today? Git bisect allows you to identify a particular commit which breaks a build, even after development has continued past that commit. So for example, say you:

  • Commit some code which (unknowing to you) happens to break the build
  • You then …

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

The hierarchy of Mystical Arts in Programming

Posted on Wed 29 February 2012 in Posts • Tagged with perl, python

I was responding to an incredibly detailed answer on StackOverflow on Python metaclasses , when I wrote the following on my whiteboard:

original whiteboard contents

I thought this was clever, and gave the (I thought clever) response on StackOverflow which read:

I read this and think of the famous "There are lies, damned lies …


Continue reading

Python HTMLParser and super()

Posted on Thu 16 February 2012 in Posts • Tagged with python, inheritance

So I have a class that inherits from HTMLParser, and I want to call the super class init (the __init__ of HTMLParser), I would think I should do:

class MyParser(HTMLParser):
    def __init__(self):
        super(MyParser, self).__init__()

But this causes a problem:

myparser = MyParser()

Traceback (most recent call last …

Continue reading