Thread and Multiprocessing Pools are an underused feature of Python. In my opinion, they are the easiest way to dip your feet into concurrency, and yet still the method I use most often. They allow you to easily offload CPU or I/O bound tasks to a...
Continue reading...Chris Griffith
The Birthday Paradox – The Proof is in the Python
This month is my wife’s, mother’s and my own birthday, all within a span of nine days. What are the odds of that? No idea, I’m no statistician. However, as a developer, I thought it would be fun to prove (or disprove?) the Birthday Paradox with...
Continue reading...Reusables – Part 2: Wrappers
Spice up your code with wrappers! In Python, a wrapper, also known as a decorator, is simply encapsulating a function within other functions. @wrapper def my_func(a, b=2): print(b) @meta_decorator(foo=”bar”) def my_other_func(**kwargs): print(kwargs) In Reusables, all the wrappers take arguments, aka meta decorators, so you will at...
Continue reading...Reuse the work of others for profit! (Vega 64 Edition)
As I sit here, anxious for the new AMD Vega 64 to be released, I decide to keep myself busy writing some Python code….designed to text me as soon as a new “rx vega 64” search term showed up on Amazon (I have the patience of...
Continue reading...Is it easier to ask for forgiveness in Python?
Is Python more suited for EAFP or LBYL coding styles? It has been debated across message boards, email chains, stackoverflow, twitter and workplaces. It’s not as heated as some other battles; like how spaces are better than tabs, or that nano is indisputably the best terminal...
Continue reading...