HRHemil Ruparelinrahem027.hashnode.dev·Sep 16, 2020 · 2 min readWhy 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...01E
HRHemil Ruparelinrahem027.hashnode.dev·Aug 15, 2020 · 1 min readTrailing 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'>01E
HRHemil Ruparelinrahem027.hashnode.dev·Aug 15, 2020 · 2 min readWhen 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()):...01E