Pythonista project preservation

After owning Pythonista for months, I finally got to use it seriously yesterday, and it worked like a champ, allowing me to solve a problem for a client quickly while I was out of the office. My tweet about it led a couple of people to ask for a more detailed description. Rereading the tweet, I see that although every word in it is true, it makes both me and Pythonista sound miraculous.

Just used Pythonista to solve a client’s problem on my phone from gas station parking lot.
Dr. Drang (@drdrang) Wed Jul 3 2013 12:42 PM CDT

I hope the fuller description isn’t disappointing.

I was driving off for a long weekend on Wednesday morning when I got a call from a client who had contractors out on a job site and needed some questions answered right away. These were, of course, questions that could have been answered in a more leisurely fashion if the client had spent a little time in the month since we last talked surveying the job site for possible problems. But I’m not here to complain about that, nor about the lack of foresight that would lead someone to put contacting an outside consultant on July 3rd—a day when most Americans, like me, are trying to skip out of work to stretch a vacation—on the critical path to project completion. No, I’m here to talk about Pythonista.

I got off the interstate at the next exit, parked at a gas station, and called the client back to get as many details as possible. As I said, I hadn’t worked on the project in a month, and of course I didn’t have any of my file materials handy, so I needed to get back up to speed. I can’t give any real details about the project, but I can say that it involved a sampling plan I had devised for the inspection and testing of some building components. The client had just learned that certain components that were to be tested were unavailable and the plan would have to be revised. The contractors who were going to extract the samples were standing by, on the clock.

The plan involved the generation of a random sample from the population of available building components. After my call with the client was over, I sketched out a simple Python program, using the random library, to generate the sample. As I typed it into Pythonista, I realized I wasn’t entirely certain about the syntax of one of the library functions. Luckily, Pythonista includes the complete set of docs from the standard library, and my uncertainty was soon put to rest.

The program itself was quite short, and I soon had the revamped plan ready. I emailed it off to the client, topped off the gas tank, and got back on the road. In total, the delay was about half an hour, most of which was the phone call.

Could I have done the work without Pythonista? I suppose so, but it wouldn’t have been as easy. I might have been able to work out a JavaScript solution, but I’m not as familiar with JavaScript’s random number routines as I am with Python’s. And I suppose I could have worked out a way of generating the sample through a series of coin flips, but that would’ve taken much longer and would’ve been much easier to screw up. Pythonista made it simple.

Most important, I haven’t heard back from the client.