rahem027.hashnode.devWhy name spacing using filenames is broken?Two other titles I debated between are "Why library code should always use absolute imports" and the click bait "How I broke python using two simple (innocent) lines of code" Here is the code: import logging logger = logging.getLogger(__name__) Not...Sep 16, 2020·2 min read
rahem027.hashnode.devTrailing commas in pythonThis has tripped me off way more than I would like. For those of you who don't know adding a comma makes a variable into tuple (Yes its not the C bracket) foo = 1, print(type(foo)) It prints: <class 'tuple'>Aug 15, 2020·1 min read
rahem027.hashnode.devWhen should default function arguments be evaluated?I was writing my first app and I found a bug. The date time column in my database always had the same value. I found out that this value changed upon restarting the server. This was the problematic piece of code: def foo(param, now=datetime.now()):...Aug 15, 2020·2 min read