3 ms·
I've been having fun transpiling python floats into rust f64 and c++ double last few months. Sometimes the rust way of doing things is very detail oriented and
by adsharma 5y ago
I've been having fun transpiling python floats into rust f64 and c++ double last few months.
Sometimes the rust way of doing things is very detail oriented and breaks the smooth flow of thought to code that python enables.
Probably best to make that zoom call (write python) and then have an evidence based conversation about how you didn't lose precision and performance is as good as rust or c++.
- Stratoscope 5y agoBoth of my Steves predated the pandemic, but yes, whether Zoom, face to face, or a phone call, that is excellent advice which I followed each time. Unfortunately they were both very strong-willed, and I didn't get anywhere with either of them. I ran into the first Steve at a natural food store in Palo Alto. We got to talking about this little computer company he was starting with a friend and how they needed a 6502 disassembler. We didn't have a business deal or anything, but I was curious about the 6502 and it sounded like a fun side project, so I got to work on it. He called me a couple of days later to tell me I wasn't capable of doing it. I tried to explain that I'd written code on a variety of computer architectures and the 6502 was a fairly simple one, but he said "I'm sorry, my mind is made up. You couldn't possibly do this." I said to myself, "who is this Steve guy telling me I can't program?!" I went ahead and wrote enough of the disassembler to be a good proof of concept. Our phone call hadn't gone well, so I decided to visit their office with a printout and show him the code. It was listed at 770 Welch Road, near the Stanford Barn. When I got there, nothing looked like a computer company, there was just a row of telephone switchboards. I told one of the telephone operators I was looking for Apple Computer, and she said "um, this is their answering service." So I walked out and told myself, "These guys are flakes. They're never going to make it." The second Steve was a little less interesting. I found out about his objection to Python floats near the end of a team meeting, and he had another objection too. Some of our code would need to be written in C++ regardless, and there was no way to call C++ code from Python. I told him about CLIF and SWIG, which were both widely used at our company, and I explained the float vs. double thing. But like the other Steve, he said "my mind is made up, we have to rewrite everything in C++."
- deleted 5y ago[deleted]
- andi999 5y agoWell, the second Steve case really depends on the overall outlook. If a big chunk needs to be in C++ then the question is, do you really want to have two languages at the problem? Especially if the goal is a shipable binary later (which is possible but painful in python). Also it is a question about available stuff.
- Stratoscope 5y agoYes, those are valid and important considerations. In this case it didn't need to be a shippable binary, it was just run internally. We had the infrastructure to seamlessly handle a mix of Python and C++, and the team members were familiar with both languages - other than the exceptions noted above. This was a set of geographic data importers for some messy data in a variety of formats from multiple countries. The data quality was so bad that north and south were sometimes reversed, or even worse, north and west would be reversed, among many other problems. This required a lot of ad hoc code to clean up the data. It was originally written in C++, with all the data importers linked into a monolithic binary with an eight-minute build time for a one-line change. (Or a half-hour for a full build.) So if you spotted one data error and wanted to clean it up, it was an eight-minute wait to try your code. When I changed it to use a Python front end that cleaned up the data and fed it to a simplified C++ back end for the compute intensive part, the C++ code hardly ever had to be rebuilt, and there was no build time at all for the Python part. So you could explore the data interactively and easily figure out how to clean it up. Technically, this was a huge win. Socially, not so much. OTOH, if you ever interview me and ask the "behavioral" questions: "Tell me about a time when a project went really well" and then "Tell me about a time when a project didn't go so well", I can use this episode for both questions!
- andi999 5y agoThanks. I agree, this is like a textbook case when to use a hybrid approach. Maybe the manager wanted to make sure he will always have enough people assigned to the project (so make it more difficult to maintain)? (A very dark management pattern)