Use Protobufs not JSON

Py-x-Protobuf - Or How I Learned to Stop Worrying and Love Protocol Buffers

TLDR Protobufs are a mainstay of microservice development. You can use them in lieu of JSONs when interacting with a webservice. They’re much faster than JSON when you’re deserializing or serializing them. They’re designed mostly for applications that talk to each other. They’d make excellent choices for MCP-centric applications as well. Introduction I first heard about protobufs from a friend working at Gojek in 2017. I didn’t know what they were used for and even when I looked them up, I didn’t understand what I needed them for....

April 20, 2025 Â· 5 min

Fixed Length Iterables in Python

If you want to create an iterable of fixed length in Python, use collections.deque with the maxlen parameter. 1 2 3 4 5 6 7 8 9 10 import collections fixed_list = collections.deque(5*[None], 10) # this is now a fixed list of 10 items. # by appending more items, you'd be # dropping items from the beginning fixed_list.append(1) print(fixed_list) This is a short article, mostly to record something I see a lot of junior developers try to implement themselves....

April 14, 2025 Â· 1 min

Python Reverse a List

There are a couple of ways to reverse a list in python: 1 2 3 4 5 my_list = [1,2,3,"apples","banana","fish","chicken"] reverse_list_one = my_list[::-1] reverse_list_one = reversed(my_list) reverse_list_zero = my_list reverse_list_zero.reverse() Of these three ways, I prefer using reversed because it is readable and there’s no ambiguity about whether it does it in place or not. It should be obvious to most people that .reverse() reverses a list in place, but I prefer the verbosity of the method that returns a reversed list....

April 13, 2025 Â· 3 min