2022-11-28
|~3 min read
|460 words
A problem I’ve run into a number of times when working with Python is when I have a object that I want to include in an API call. The first…
2022-11-28
|~8 min read
|1402 words
Recently, I was working on a project where the API I was using would sometimes decide to include an offset for the timestamp and other times…
2022-11-28
|~6 min read
|1053 words
Imagine a function that, under certain conditions expects to throw an error. How might we test that with Pytest? Pytest offers two…
2022-11-28
|~10 min read
|1825 words
Within Python’s testing framework , markers can decorate a test method (i.e. a method which has a name beginning and inside a file prefixed…
2022-11-28
|~3 min read
|518 words
Python’s virtual environments are a way to avoid conflicting dependencies. For example - imagine you have two Python projects that both use…
2022-11-28
|~1 min read
|146 words
Previously, I wrote about raising custom exceptions, but it was a hamstrung approach. It didn’t actually enable any information to be passed…
2022-11-28
|~2 min read
|365 words
I’ve been exploring Poetry as an alternative to pip and pipenv recently. As pleasant as it has been, I knew I wasn’t taking advantage of all…
2022-11-28
|~2 min read
|249 words
I was recently working on a Python script that needed to access AWS resources. Fortunately, that’s exactly what the library boto3 is for…
2022-11-28
|~2 min read
|281 words
If a Python program receives values it cannot handle, it can abort by raising an exception. Most of errors in Python are built on the…
2022-11-28
|~2 min read
|309 words
The following post is inspired by Trey Hunner’s great post on looping with indexes in Python. What’s below: Standard loop through an…
2022-11-28
|~2 min read
|225 words
Previously, I wrote about basic use cases of list comprehension in Python. Today’s example is slightly different and has to do with chunking…
2022-11-28
|~5 min read
|872 words
Logging in Python is quite easy (once you know the basics). Unlike Javascript, where you’ll need to build your own logger, or use a third…
2022-11-28
|~3 min read
|447 words
Unlike a list or a dictionary, in Python, tuples are immutable.1 This is clear when investigating the methods available on the object…
2022-11-28
|~3 min read
|469 words
Over the past few days I’ve been exploring different data structures and built-in methods with Python. I looked at strings, lists basics…
2022-11-28
|~1 min read
|186 words
I like pretty things. Particularly when they hold the answer to my questions! As a result, when working with objects (aka Dictionaries in…
2022-11-28
|~5 min read
|994 words
Python has a very concise syntax for creating new lists called List Comprehension. List comprehension is a way to define a new list based on…
2022-11-28
|~3 min read
|601 words
Lists in Python are similar to arrays, though there are some idiosyncrasies to how the methods work in Python (at least relative to…
2022-11-28
|~2 min read
|371 words
Continuing my basics education of Python, here are some examples of flow control. I’ll explore the following: If, else if, and else…
2022-11-28
|~2 min read
|304 words
I recently was converting a Python dictionary to a JSON object to include in the body of a POST request. Unfortunately, this triggered a…
2022-11-28
|~1 min read
|198 words
There are a number of different ways to write / format strings in Python. Template Strings This GeeksforGeeks article is a helpful…
2022-11-28
|~1 min read
|159 words
Just like Javascript, in Python, not everything’s black and white. Here too there are truthy things and falsey values. Also, like Javascript…
2022-11-28
|~5 min read
|968 words
It looks like I’ll be doing some more python development in the near future, so time to brush up! First things first though: getting a…
2022-11-28
|~2 min read
|240 words
I was recently trying to find the parts of my python application that were lagging in performance and so I went in search of a way to…
2022-11-28
|~2 min read
|326 words
I recently had to run an application built with Python 3.6. Unfortunately, when I looked at the installed version of python on my OS, it was…