Profile avatar
murrayh.bsky.social
UK based software engineer. Used to be a scientist. Posting about software, nature, cats, etc.
126 posts 147 followers 58 following
Regular Contributor
Active Commenter

Use contextlib.suppress to ignore specific exceptions in a simpler way than try/except. #python #pythontips

Use itertools.pairwise() to iterate over consecutive items in a sequence. Helps avoid off-by-one errors! #python pythontips

Dataclasses aren't just for storing data — use __post_init__ for validation or derived attributes. #python #pythontips

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

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

Your cat doesn't rub against you because they love you. They’re actually marking you with their scent. Congratulations, you’re now property.

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

Use Django’s built-in get_object_or_404() instead of try/except when fetching a single object.

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

Scientists have found that cats can make over 100 different sounds. Unfortunately, almost all of them mean 'feed me.'

ME: did you save it? ONEDRIVE: hypothetically, yes

Spot on

Arches National Park Grand County, Utah, USA Photo courtesy of: Interesting Facts

Absolutely crazy cat fact of the day: Cats can't taste sweetness. #cats #catfacts

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

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

film stills #36-39 The goats of Severance. #severance

Status update: fast asleep. #caterdat #cats

🤍 Good morning 🤍 Happy #Caturday

permutations and combinations from pythons itertools are insanely powerful. #python

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

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

Did you know python has ternary operators too? value = 'yes' if condition else 'no'. #python #pythontips #programming