1,767 karma · joined Jul 4, 2021 (5y ago) · 363 submissions
comment 3d ago · link · parent
I was not there for Python 3, but I was at a larger place that had ~2 million lines of Python 2 code when the migration happened. It was much easier than I had expected. The two key differences from other stories I was hearing was that were a lot of automated tests (nearly 100K of them), and we had someone who was very good at writing parsers. He spent a few weeks automating the changes and getting tests to pass, and the night he ran the final conversion was remarkably clean. We never even used `six`.
comment 3d ago · link · parent
Hiring devs who already knew Python was not really an option in 1997. But we quickly found that there was not much difference in time to ramp up a C++ developer on our C++ codebase vs. ramping up a developer on Python plus our Python codebase. It was just a matter of finding developers who were happy to learn a language they may or may not have heard of, but had likely never looked into.
comment 3d ago · link · parent
The port was pretty direct, function for function. It was even line for line where language and library differences didn't offer an easier way. I was just trying to see if Python was so slow that we couldn't consider using it in production, and this was the most speed critical batch we had.
I assumed the speed difference was a bug that was skipping work, but that seemed unlikely because the output was correct. It turned out to be a bug in the C++ code that was needlessly reproducing work (an issue with cache keys). The bug was extremely subtle. When I fixed the C++, there was very little difference in speed as the batch was I/O bound when the cache was working.
So, adding to your point, sometimes you can greatly improve speed by rewriting in a slower language, even without performance in mind.
comment 1w ago · link · parent
It was a 1-2M line codebase built in the Python 2.3-2.5 years. A pattern that had evolved in that codebase was to pass around a context dict to every non-trivial call. It was always the first parameter (other than `self`) and always had the same name. The only way to know the contents of the dict was to know the upstream call path to your function (not just the stack, any detours could have written into it as well). Things like a "price" whose value might be an integer number of US pennies or a Money object with a value and a currency identifier (e.g., USD, JPY, etc.). Much of the code just assumed it was whatever it was the first time they inspected the context dict as it arrived at their call site. Someone else modifies a code path and suddenly the contents of the context dict change on you. If your automated tests don't include that new code path, you catch the issue in prod. So, automated tests had to include all possible run-time call paths to catch these bugs before deployment, and that's impractical.
To me, one of the most important advancements Python has ever made is frozen, kw_only dataclasses with thorough type hints. They bring a lot of clarity to the code that uses them, such code is easier to test, and there are fewer bugs discovered at run-time. Extensive use of them makes type inference easier, so hints can me skipped in many places. Any difficulty in creating them often means the data model is not sufficiently flushed out, and that's good to know. I rarely write non-dataclass classes in recent years. I do add read-only properties to dataclasses liberally.
All this fixes many of the challenges that come with Python's highly dynamic nature, but let us keep many of the benefits.
comment 2w ago · link · parent
For the last ~1/3 of my career I was a manager, and most of that time was in the office. Being remote as a manager was a lot harder for me. I found it so much easier to understand where someone's head was at when we could sit in a room or take a walk together. If I saw them fidgeting more than usual in a one-on-one, I could try to figure out if there was something they were having trouble bringing up, or if they just weren't feeling like spending time together that day. If I saw a different look on their face than usual when they were at their desks, I could use that as a trigger to check-in and see if there was anything I could help with. It was a lot harder when those little clues were missing, especially during a difficult time like the pandemic. I eventually learned to replace some of that with DMs ("Hi there, it's been a few days since we've chatted, so I wanted to check-in to see how you're doing. Anything I can do for you?"), but it was more like me polling than me getting notifications, so it felt more intrusive and less efficient.
That's all just me. I think the differences vary a lot by person, by role, and even by team/company. There were certainly periods where being able to grab lunch and/or a whiteboard was extremely valuable (and fun!).
comment 2w ago · link · parent
I came across all this when building maps for sales territories defined by ZIP codes. I needed to have a simple, clean partitioning of the US for this use case, and ZIP codes are not that. So I took all ZIP codes as points and generated a Voronoi diagram to yield clean, non-overlapping polygons that covered every point in the country. That was plenty good for the purposes of doing visualizations of the US split into tens of territories.
comment 2w ago · link · parent
There are also many cases of people waving their right to appeal once sentenced, which can cause challenges for their counsel (from the link: "Should a death-row inmate who wishes to waive his appeals be viewed as a client making a legal decision to accept the justness of his punishment, or as a person seeking the aid of the state in committing suicide?"): https://repository.law.umich.edu/cgi/viewcontent.cgi?article...
There are difficult issues everywhere you look with the death penalty. The one I can't understand how people get past is execution of the wrongfully convicted. Any justice system is flawed and makes mistakes - it's just too complicated to establish absolute truth when so many people with diverse motivations are involved in the process. We can save money by just putting them in prison until they die, giving us the option to partially undo the sentence in cases where innocence is later established.
comment 1mo ago · link · parent
comment 1mo ago · link · parent
comment 1mo ago · link · parent
comment 1mo ago · link · parent
On the LLM front, it's been a fascinating journey for me. I started with the private beta of Github Copilot. I was an instant convert for the "better code completion" aspect. But my first attempts with coding agents were rough enough that I stayed away.
I'm now retired, but I want to understand how things are evolving. So two months ago I volunteered to automate a cartography data pipeline for an educator. I have a background in all aspects of the project. It's not simple - there are several data sources from governmental and corporate sources that need to be integrated together, and most of them are updated every few minutes. New maps need to be available within ~5 minutes of a data source updating. All this with many GB of data and running on a low powered machine, taking less than 2GB of RAM.
I bought some DeepSeek tokens and went to work. A few weeks later a mentee went to work at OpenAI and gave me a "friends and family" Pro level plan. I'm converted, and I absolutely see it as a tool in the sense Rich describes. I even question whether any "software engineers" using it, but not as a tool, are doing it right (I'd love to be educated if I'm wrong!).
I'm still learning, but that's part of the disagreement I have with Rich's take. He mentioned feedback. I often watch the "reasoning" process the agent goes through to see the approach it's taking. It's not at all unusual for me to steer it when I see it going in a direction I don't like. I've also found an incredibly powerful pattern where I can explore the approach I want to take for a part of the system with the agent. I have it create prototypes with different strategies (streaming vs. in-memory, different data structures, relying on various libraries, etc.) and then I have it characterize trade-offs between the prototypes (performance, memory usage, conceptual simplicity, code simplicity, etc.). This allows me to make informed decisions about which approaches to pursue further, and my decades of experience in software engineering constantly go to good use here.
It's also given me the time to go far deeper into things I never could have justified. Of course the project has 100% code coverage and branch coverage. It also has hundreds of property-based tests. And thousands of Lean proofs of the behavior of the algorithms, along with conformance tests that the code and the Lean adaptation of that code behave the same way. And lots of TLA+ verification of the overall flow of the system. None of that proves there are no bugs or that this is the right system, that's all on me. A month in I would have said I was fairly happy with the quality. Now I'm proud of the quality.
As I've gone through this process, I've dug into the code for patterns I don't like, and had the agent clean them up, all the while distilling guidance. I've had a lot of luck with that guidance being followed once I figured out the right place to put it and to reference it. I've spent entire days doing nothing but giving prompts to do specific refactoring. The beauty is that large refactorings don't involve the same boredom interrupted by anxiety they used to for me.
English prose (documentation, comments in the code, etc.) is what I've been the least happy with. An hour ago I had the idea to give it ~1,000 lines of my HN comments and ask it to characterize the style and tone of the technical parts. Then I told it to turn that into guidance. Then I told it to rephrase that same guidance in a way that follows the guidance. I would never mistake the result as my own, but it's much, much better than what it was producing before. While I've been writing this comment, it's been applying it to all prose in the project.
This very much feels like a tool that is letting me shape the project (and shape the tool itself). But it's letting me do it at a higher level. It handles the code so I can fully focus on the architecture, algorithms, and quality. This alone makes me think that the best simple guidance for quality results is dozens of prompts per day, not a handful (when a day is 100% focused on development). When you can't think of dozens of prompts, think and explore more (the agent can help with that!). That does require you know what quality is and how that can be achieved.
To reconcile this with what Rich is saying. I suppose he's right that it's not a tool for writing code. But it very much feels like a tool I'm wielding to do software engineering at a far more powerful level than I could have done without it. The resulting project has "me" everywhere in it. The people who know my work the best would look at this project and know that it's mine. Perhaps not the code, but the algorithms, the data flow, the approach to documentation and testing, etc.
For anyone curious, the project is getting close to 200K lines. About 25% of that is the code that is the data pipeline. About 25% is documentation. About 50% is testing and verification. One reason this is possible is that I'm working alone and have full control over the process (what I spend before it became free, how it's built, what my process is, and even the product definition within the constraints of what's valuable to the intended user). All told, it has been about 6 weeks of full time work worth of my time.
The next experiment... a web front-end to this system for the general public. This is not at all in my wheelhouse, so it should be interesting to see how much my blind spots cost me.
comment 1mo ago · link · parent
comment 1mo ago · link · parent
What's your negative weight on killing someone who is innocent? A justice system cannot be perfect. There are too many people, too many motivations/biases, and too much nuance involved. If a justice system is not perfect and it executes people, innocent people will have their lives unjustly taken from them by us. If it's 99.9% accurate (I'd argue that even 99% is an impossibly high bar), then an innocent person has likely been intentionally killed by the federal and/or state governments in the last 20 years. Are you cool with that? After execution, it's not generally possible to file an appeal on behalf of the executed even if new evidence demonstrates innocence. This has the implication of multiple injustices - an innocent person is killed by the state, the true murderer gets no punishment, and society incurs the risk of wrongful execution with no protection from the true murderer.
Or we could take the less expensive, partially reversible route of putting the convicted in jail until they die.
If you'd like to understand the imperfection more concretely: https://en.wikipedia.org/wiki/List_of_wrongful_convictions_i...
comment 1mo ago · link · parent
I completely agree with you about how fun these things can be. I've long believed in automated testing methods that were beyond what I could justify. I learned about formal methods in college in the 1980s and have never been able to justify (even to myself) applying them. Now a volunteer project I've been working on has 100% standard test coverage, many property-based tests, and 1000s of formal verification tests. That combination has surfaced multiple bugs in widely used underlying libraries and a bug in Rosetta 2's Intel emulation that was affecting me. And that's all just on the testing front. I'm having a lot of fun with all this.
comment 2mo ago · link · parent
comment 2mo ago · link · parent
Another spectrum that I've found useful to explore is the scope of what I ask the coding agent to do in one turn. I see some people trying to do one massive prompt that the coding agent works on for a day or more. I find a large boost in overall quality if I do 10-20 prompts per day (not counting the prompts where I'm just trying to understand things). It's still much less of my time than hand-coding, but the resulting architecture looks like my own. The quality of the overall system is great. There are certainly issues here and there in the code, but it's always that way once a project gets large enough. Now it's easier to address any particular issue throughout the code base in one go.
comment 2mo ago · link · parent
Absolutely! When I'm the interviewer, I look for a genuine opportunity to amicably express disagreement with the candidate in order to see what it's like to navigate that with them. It's a great sign when we both end up enjoying learning from each other as a result of the exchange.
comment 2mo ago · link · parent
Even if you think that LeetCode evaluates how smart someone is, that's not what companies should be trying to measure. It doesn't matter how smart someone is if those smarts won't be put to good use. One of the smartest people I ever worked with was an amazing fit and launched the team to new heights. Another of the smartest people I ever worked with was a net negative for team productivity because he was such a jerk to people that those people would spend tons of their time and energy to find ways to avoid working with him. Despite all his smarts, he was a terrible match for the role and therefore was not productive. Being a jerk in some environments might even be a positive, but that's part of evaluating fit.
comment 2mo ago · link · parent
comment 3mo ago · link · parent
""" After the first beta, no new features can go in, but feature fixes (including significant changes to new features), bug fixes, and security fixes are accepted for the upcoming feature release. """
So it's a fairly well known target. Bruce Eckel published the first edition of this book a quarter of a century ago - he has a pretty good handle on the progression of Python.
Definitions and status for all releases is at https://devguide.python.org/versions/
comment 3mo ago · link · parent
comment 3mo ago · link · parent
comment 3mo ago · link · parent
The next tier down was kind of the opposite. They weren't big enough to surface things like this, and they hired agencies for most of their ad spend. When focusing on the top of the funnel, there's this strange incentive with agencies where they often get more budget to spend if they can connect that directly to eye balls. Agencies are incentivized to throw the ads up everywhere and pay well to do so. They love cost-per-impression because we could deliver a large, predictable number of eye balls in a hurry.
All that said, we put no effort into getting around ad blockers as we were serving these ads on our own site/app and we viewed fighting ad blockers as fighting our users. Our ads were served inline in HTML, but clearly identified in the HTML of the page. It took blockers a while to catch on and block them, but they eventually did.
comment 3mo ago · link · parent
> the error bars would be so large as to make drawing conclusions from these numbers seem pointless
That is often the case, and being truly data based requires acknowledging that. We can then act based on other data, or admit that we're falling back to intuition and abandoning data based decision making for now.
comment 3mo ago · link · parent
comment 3mo ago · link · parent
comment 3mo ago · link · parent
While the entire video is fun, the link is cued up to a place where there's a lot going on, but it's slow enough that you can kind of see what he's doing. Watch his knees to see what he's doing with pedals. Notice that his hands seem to be going in cycles, but there are subtle variations in the cycles.
At 8:54, strobe lights start up - that can't make it simpler to keep this focus. What he's doing looks essentially impossible to me, but I'm well aware that I don't know enough to understand just how insanely difficult it really is.