travisd
travisd on Hacker News
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.
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).
The AI generated images are classic slop to the point of being actively distracting.
Posted by
travisd on Thursday August 20, 2026 @01:22PM
from the atg.wa.gov dept.
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.
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.
packets udp bar walk a into
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).
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.
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.
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.
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).
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.
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.
Pardon the pedantry, but this reflects the casual/conversational uses of “hash function” not the more general definition. To be a hash function, it just has to map a set to another set of fix sized values (usually some finite set of the natural numbers).
Returning unrelated (distant) hashes for similar inputs is a possible property of a hash function, and oftentimes a desirable one (especially for cryptography), but there are in fact use cases where one wants similar inputs to map to similar (or the same) hash. https://en.m.wikipedia.org/wiki/Locality-sensitive_hashing
It's worth noting that it's much less of a problem in Python due to the lack of ergonomic closures/lambdas. You have to construct rather esoteric looking code for it to be a problem.
add_n = []
for n in range(10):
add_n.append(lambda x: x + n)
add_n[9](10) # 19
add_n[0](10) # 19
This isn't to say it's *not* a footgun (and it has bit me in Python before), but it's much worse in Go due to the idiomatic use of goroutines in a loop:
for i := 0; i < 10; i++ {
go func() { fmt.Printf("num: %d\n", i) }()
}
Curious to know -- how do these kinds of things affect accessibility for visually impaired people? If you're using a screenreader, do these kinds of things work?
Yep, I think those things are all related.
Go generally is pretty conservative about that kind of thing (namely, compiler optimizations). Go generally abides by a “what you write is what you get” kind of thing, especially when it comes to “non-local” optimizations. It’s generally opposed to anything that’s “clever.” (Just my feeling as someone who uses Go pretty often and who respects the choice they’ve made on that spectrum).
I suspect this is a bad-faith argument, but just to be clear, NPR get's a tiny fraction of its funding from the government *and* maintains editorial independence.
> The news organization says that is inaccurate and misleading, given that NPR is a private, nonprofit company with editorial independence. It receives less than 1 percent of its $300 million annual budget from the federally funded Corporation for Public Broadcasting.
We’re not talking about why Seattle is far from Miami. American city sprawl is largely a recent phenomenon (post WWII) and was enabled by the rise of the personal automobile. Even the sprawl-iest of cities (Houston, TX) used to be respectably dense and walkable. The need for a car to achieve basic needs (groceries, school, work) is a phenomenon well less than 100 years old. America has this problem in part because it’s much younger than a lot of European cities, but it’s certainly not purely a function of topography.
Parent comment is concerned with privacy, not authenticity. They're not worried that someone modified their code, they're worried that someone saw it.
The author just spends the final paragraphs… guessing?
> TypeScript… JavaScript… Going to guess it's similar.
> I haven't touched Java for almost a decade
> I don't really know enough Rust to be able to comment with any confidence
Posted by
travisd on Friday January 13, 2023 @05:58PM
from the medium.com dept.
Posted by
travisd on Friday January 13, 2023 @01:14PM
from the aviator.co dept.
Since the author is responding to comments here: are there any changes coming soon that necessitated this?
Lot of people confused here -- the "running JavaScript when the browser is idle" part is a bit misleading.
It doesn't run stuff when you're the tab is backgrounded (browsers already heavily reduce what sites can do when not in focus[1]). Instead, it just lets you delay work until the page isn't doing anything else (such as rendering the page). For example, you might do this when updating a visualization on a page so that the other updates can complete first (e.g., update the input UI and redraw the visualization when that's done).
[1] https://blog.chromium.org/2020/11/tab-throttling-and-more-pe...
I also hate this about Go, but its (partial) saving grace here is the `x, err := NewX()` pattern which (at least for me) tends to prevent a decent number of these issues in practice since usually either `x` is non-nil
xor `err` is non-nil.
Makes the
// Java
name = personService.getPerson(123).getName()
problem less likely since you'd generally have to write:
// Go
person, err := personService.GetPerson(123)
if err != nil { ... }
name, err := person.Name()
if err != nil { ... }
Definitely more verbose than maybe
// TypeScript
personService.getPerson(123)?.getName()
but I think that's part of Go's tradeoffs -- much more likely that errors will be annotated more correctly (i.e., in Go you'd be more likely return an error like "failed to load person: 123" if it was the GetPerson call that failed rather than a generic error that doesn't describe which step failed)