Back in October 2015 I wrote this post about cleaning up some data in one of our databases. he problem was essentially two-fold. Remove duplicates and then retain items that were not found in a validation list.
I’m writing this as a first new post on this the newest incantation of my blog as a way of charting how far I’ve come in 18 or so months.
Here’s How I did the original version:
Twelve lines of code (plus comments). I was pretty chuffed with that back then!
Here’s how I’d write it now:
So that’s a 50% shorter script. Back then I had no idea what a set was, or heard of list comprehension. Oh, and I’m a bit more PEP8 compliant these days!
It’s funny reading a lot of my old code now. My current code is far from amazing, but it’s certainly better than it was.
The moral of this story - keep going, you will improve!