Murray
banner
murrayh.bsky.social
Murray
@murrayh.bsky.social
UK based software engineer. Used to be a scientist. Posting about software, nature, cats, etc.
Use contextlib.suppress to ignore specific exceptions in a simpler way than try/except. #python #pythontips
April 13, 2025 at 12:28 PM
Use itertools.pairwise() to iterate over consecutive items in a sequence. Helps avoid off-by-one errors! #python pythontips
April 7, 2025 at 11:30 AM
Dataclasses aren't just for storing data — use __post_init__ for validation or derived attributes. #python #pythontips
April 6, 2025 at 12:13 PM
functools.cache is a zero-argument version of lru_cache with unlimited size — perfect for memoizing pure functions without worrying about cache size limits. #python
April 5, 2025 at 4:39 PM
Use Django's bulk_create() for batch inserts instead of loops:

Model.objects.bulk_create([Model(name="A"), Model(name="B")])
Way faster than calling .save() in a loop!
#DjangoPerformance
March 11, 2025 at 1:31 PM
Your cat doesn't rub against you because they love you. They’re actually marking you with their scent. Congratulations, you’re now property.
March 11, 2025 at 11:32 AM
Django’s values_list() is great for fetching only what you need.

emails = User.objects.values_list("email", flat=True). This fetches just the email field instead of entire objects → faster & memory efficient!
#DjangoTips
March 11, 2025 at 11:11 AM
Use Django’s built-in get_object_or_404() instead of try/except when fetching a single object.
March 7, 2025 at 2:14 PM
Set blank=True vs null=True in models carefully.
🔹 blank=True → field can be empty in forms
🔹 null=True → stores NULL in DB
Use null=True only for non-text fields!
#Django
March 5, 2025 at 3:10 PM
Scientists have found that cats can make over 100 different sounds. Unfortunately, almost all of them mean 'feed me.'
March 3, 2025 at 2:01 PM
Reposted by Murray
ME: did you save it?

ONEDRIVE: hypothetically, yes
February 7, 2025 at 2:58 PM
Reposted by Murray
Spot on
February 7, 2025 at 10:22 AM
Reposted by Murray
Arches National Park
Grand County, Utah, USA

Photo courtesy of:
Interesting Facts
February 6, 2025 at 1:18 AM
Reposted by Murray
February 4, 2025 at 1:14 AM
Absolutely crazy cat fact of the day: Cats can't taste sweetness. #cats #catfacts
February 4, 2025 at 9:12 AM
Does anyone know if cats can lose their sense of smell? I swear Eddie can only find food by sight or sound. You can open cheese and he seems to have no idea until he sees it, and then he's all over it
February 3, 2025 at 10:02 AM
According to the internet, a cat's tail can express a wide range of emotions, from happiness to fear. But I swear Eddie's only expresses "I love you" or "I'm going to bite you, no matter where you move to" #cats
February 2, 2025 at 11:11 AM
Reposted by Murray
film stills #36-39

The goats of Severance.

#severance
February 2, 2025 at 12:50 AM
Status update: fast asleep. #caterdat #cats
February 1, 2025 at 9:46 PM
Reposted by Murray
🤍 Good morning 🤍
Happy #Caturday
February 1, 2025 at 11:13 AM
permutations and combinations from pythons itertools are insanely powerful. #python
February 1, 2025 at 11:55 AM
Interior design tips: if you have an ugly yellow blanket you’re not allowed to get rid of, consider arranging a cat on it to soften the eyesore.
#cats #interiordesign #design
February 1, 2025 at 7:58 AM
Cat fact of the day: When a cat kneads you with their paws, it’s a throwback to kittenhood. Kittens knead their mother’s belly to stimulate milk flow. In adulthood, it’s their way of saying, ‘I feel safe.’ #cats #catfacts
January 31, 2025 at 2:31 PM
Did you know python has ternary operators too? value = 'yes' if condition else 'no'. #python #pythontips #programming
January 31, 2025 at 10:49 AM
Check for membership efficiently: if item in my_set: #python #pythontips
January 30, 2025 at 5:01 PM