Recent submissions

Comment · 7 hours ago
Yeah, this is basically what we do. It ends up a bit more ergonomic to not have explicit result types because union types are pretty easy in Python. For example, we have functions like

    # courses.py
    def create(...) -> Course | ErrInvalid:
and they get used like

    match courses.create(...):
        case courses.Course() as course:
            # We use `course` below.
            pass
        case courses.ErrInvalid() as err:
            # Error conditions are usually translated into early returns
            raise fastapi.HTTPException(
                status.HTTP_422_UNPROCESSABLE_ENTITY, err.message
            )
    
    return APICourseCreateResponse(id=course.id, ...)
It has worked (for us at least) pretty well to reduce the number of unhandled errors that make their way into Sentry. The granularity of the error types depends on the need (e.g., sometimes we just have an `ErrInvalid` that returns a message which gets displayed to the user, but sometimes we'll have ErrInvalidAddress or ErrInvalidTaxCode to be more specific for the context).

And yeah, without nodiscard, we try™ to only do this on functions that return values that the caller will definitely need to use. Also combined with exhaustiveness checks on switch statements by default.

Comment · 1 day ago
it’s maybe less “pythonic” but at $dayjob we’ve very actively moved away from exceptions for things in favor of things that are statically type checked. too many things that become runtime bugs instead of type checking bugs.

with match now being available, we even return explicit error objects and the ergonomics are pretty good (reminds me of rust).

Comment · 2 months ago
The AI generated images are classic slop to the point of being actively distracting.
Comment · 8 months ago
I found two separate bugs in GCP products. One with gVisor where it would sometimes null-truncate large network packets (this was very hard to diagnose – why is my JSON full of null bytes?) and one where Cloud Run broke sudo sporadically (sudo in a FaaS is definitely niche, I had essentially containerized a very old application written by undergraduates).

Both times they were serious production bugs that took at least a week to resolve, though I only had the lowest tier of support package.

Comment · 9 months ago
At $DAYJOBSTARTUP, we do hackathons twice a year. At the most recent one, an engineer sat down with a designer and set him up with Cursor. The designer looked like a kind in a candy shop, he was so excited to be able to rapidly prototype with natural language and not be clicking in Figma for hours.

A month later, he comes back to the engineering team with a 10k line "index.html" file asking "How do I hand this off?" (he was definitely smart enough to know that just passing that file to us was not gonna fly). We decided to copy the designs into Figma for the handoff, both because that was the existing way we did design/engineering handoffs and also because creating high fidelity designs (e.g., "this color from our design system" and "this standard spacing value") isn't in Cursor's wheelhouse.

We're probably going to spend more time working on a better setup for him. At the very least he should be working against our codebase and components and colors and design tokens. But I'm very curious to see where it goes from here.

Comment · 9 months ago
packets udp bar walk a into
Comment · 10 months ago
Many of these package managers get invoked countless times per day (e.g., in CI to prepare an environment and run tests, while spinning up new dev/AI agent environments, etc).
Comment · 1 year ago
Starbucks is airport drink/food for me. Being able to order as I enter the TSA line and pick it up on the way to the gate is unmatched convenience, and the coffee options at airports generally aren't great.
Comment · 1 year ago
Of course! It helped your friend realize what kind of person you are and hopefully spurred them to find better friends who possess actual human empathy.
Comment · 2 years ago
Making an HTTP request and dealing with JSON data is a weed-out question at best. Not sure if you are interpreting the grandparent comment as actually having them write a JSON parser, but I don't think that's what they meant.
Comment · 2 years ago
I don’t want to disparage your work, OP, but micro-optimizing text files is often not very effective, especially after gzip. I’m curious to see if there’s any noticeable difference for a representative gzipped CSS file (since these assets are almost always served from a CDN with compression).
Comment · 2 years ago
Thanks! I hate it!
Comment · 2 years ago
I highly highly highly recommend the book “Two Wheels Good: The History and Mystery of the Bicycle.” It explores the origin, the various social implications across various cultures (it often became a symbol of perversion due to its association with women’s liberation), and even the modern day e-bike movement. 12/10 book, very well written too.
Comment · 2 years ago
Based on the article, it sounds like this doesn't activate a device's microphone at all. If it did, most (all?) browsers would give a pop-up requesting permission for that.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton