Tuesday, December 16, 2008

PyCon Talk Accepted

I received my talk acceptance email yesterday. On schedule, even! The PyCon organzers get more polished every year (I didn't submit a talk last year so maybe this isn't new). It will be interesting when they publish the stats for talk proposals. I vaguely recall that the rate was 50% last year and 80% the year before that. The attendee numbers doubled between '06 and '07 so the number of proposals likely did too.

The email included the anonymous reviews of the proposal. Most were +1 but I'll keep in mind the +0 and -1s when preparing the new version of the talk. They were mostly concerned that the PyCon UK version of the slides was too code heavy. There is even more material now that decorators are in use "in the wild" so I may shunt those into a separate tutorial-like paper or maybe just include them as slides after the end so people who download the .pdf will see them.

I'll definitely have to prep and practice the new talk well in advance of PyCon. Lots of possibilities there; The Colorado Python group get together to practice all their member's talks every year - we could get the Boston PIG to do something similar. And I could make a show-me-do thing. And I'll definitely give it to the pythoners at my old company as a trial run.

Don't forget to register early for PyCon. We maxed out the hotel some nights last year and this year should be even bigger.

Wednesday, November 12, 2008

PyCon 2009 Plans

I'll be there. I submitted a talk proposal for a further refined version of my class decorators talk. Since that talk people have actually started to write useful class decorators that weren't just replacements for metaclass hacks. The total ordering decorator, for instance, modifies a class that implements the __lt__ comparison to have ALL the comparison operators. For the talk I'll also work up a decorator to replace UserDict: define __getitem__ and the deco will add __contains__, etc. I always thought mixins were a hack, frankly.

Tuesday, September 16, 2008

Post PyCon UK

Due to my harried transit I didn't get to prepare my lightning talk "PyAsshole: Simulating a partial information non trump card drinking game in Python." I did spend my flight home working on a simulator. It currently onl-y has one strategy (random legal plays) so I have to add a player that uses my preferred strategy [play to win or - when you can't - play not to lose]. I'll also have to implement a drink count in the simulation. The idea is that no matter what the player plays he has a chance of reverting to a random play at a chance based on his drink count.

Unfortunately adding in a drink count immediately injects a social (and thus very hard to model) component to the game. The mechanical rules say you drink if you are skipped or if you pass. But the social rules say you can be made to drink for any reason by someone higher than you in the chain. People being people those optional drinks are subject to retribution and those kinds of things are very hard to model. I expect tit-for-tat to work well in simulated play but that completely ignores the human propensity which is to engage in cooperative play.

Sunday, September 14, 2008

PyCon UK: Class Decorators, Radically Simple

I'm giving a new version of my EuroPython talk, Class Decorators: Radically Simple.


Two thirds of the slides are new. There is much more front end emphasis on what decorators are and simple function decorators examples. The examples of class decorators and metaclasses have also changed.

Post Con

I changed the slide that used the old 3rd party decorator module to use the standard lib functools equivalent.

Speakers thoughts: The details of this talk were substantially different than the EuroPython version. I had more slides but there was less talky-talk involved with each one so it ended up the same at about twenty minutes. I intend to rejigger it again and submit it to PyCon as a mix of the two talks. The more concrete slides at PyCon UK went over well but most of the metaclass banter fell off and all the esoteric stuff (which will probably stay dead). The topical slide about getting my passport was skipped during the presentation - I did it as a lightning talk instead.

I wasn't nervous for the talk itself, there were maybe 75 people in the audience. I was nervous for my 5 minute lightning talk immediately afterward "How to get a new US passport same-day while committing the minimum number of felonies." I don't know why - I've spoken in front of larger crowds before and the idea of lightning talks is that they aren't expected to be polished (I had no slides and just spoke extemporaneously). The lightning talk went well and might have tied for the highest number of laugh-lines with the other humorous talk "Why I love Zeppelins."

Next time I intend to cheat and take some Beta Blockers before any speech. For those who don't know: beta blockers repress the physical symptoms of the fight-or-flight reflex only and don't change your brain. So they will suppress a quiver in your voice or hands but don't help with "umms" or "aahs." The only way to suppress the um/ah reflex is to practice before hand - a mirror works fine; just have enough canned variations on the topic that you can pick and choose the most suitable one at runtime which is more fluid than you think.

I only had one question during the talk and one question afterward. I'll have to think of ways to introduce more uncertainly into the talk for my next version. The first version At EuroPython elicited two or three questions during the talk and two or three after. Based on that feedback I answered those in this version but I'd like to generate some new ones next time.

Wednesday, September 10, 2008

PyCon UK Flight Plans

What to do with on a 12 hour flight between Boston and Birmingham (1 stop in Amersterdam)?

  • I could work on my presentation. This would be OK but not ideal since I don't have internet conectivity to look stuff up.

  • I could work on my lightning talk: "PyAsshole: Simulating a partial information non trump card drinking game in Python." I'll do some of that but I only have five hours of batteries. [if you aren't familiar see here for one set of rules]

  • I could bring Neal Stephenson's Anathem but I could fit two or three other books in my bag instead of that door stop; I'll do that because if I can't get into his book I'm stuck with it.


I'll likely do a mix of PyAsshole and books with at least one of those being Heinlein's The Moon is a Harsh Mistress which is frequently cited but which I've never read.

Monday, August 11, 2008

Speaking at UK Python

The talk schedule for UK python is posted and I'm on it. Conferences are a good time by themselves but I'd be lying if I said I don't enjoy talking in addition to attending.

The schedule is a bit funky with four rooms instead of the standard three. It is an interesting experiment so I hope one of the organizers will write up the reasons for, and the results of afterwords. UK Python is expected to be small at ~200 people (the size of PyCon 10 years ago). Small ventures are expected to experiment because the cost of failure is low and the rewards of success are high. I don't have a horse in this race so I'm happy to watch and see.

Friday, August 8, 2008

UK Python Plans

I submitted a talk this week which is hopefully not too late. I do like the idea of rolling admissions as opposed to the aspirational deadlines of other Py* conferences. "The dealine is Monday! and this time we really mean it!" The talk is a version of my EuroPython one with feedback from the first time I gave it.

I'll be there for UK python even if my talk isn't accepted (please disregard this if you are on the UK program committee). I've technically been on English soil before but practically I don't think airports really count. By the same token I've visited California and Hawaii.

See you there and hopefully the yobs, chavs, and hoodies aren't as bad as the UK papers make out*.

* There were many commonwealth attendees at EuroPython and the pan-national conference attracted ex-patriots in particular. I've always toyed with the idea of being an expat and some nudged me to expatriate to the UK. I dismissed the idea with some bluster about not being able to carry a gun or a proper knife. Not that I carry a gun; the nice thing about being an American is the free rider effect (crims don't know that you aren't carrying, they just know that some people are). I will be at the range tomorrow and will likely post pictures on my non-python blog.

Monday, July 28, 2008

German, American, or Other? Part II

My PyCon 2008 posts included an item "German, American, or Other" with a list of core python developers (anyone with subversion privs) and a guessing game on nationality. I just updated the post with some statistics on how many Americans come from German immigrants (hint: lots) but I'll repeat the update up top.

German ancestry is dominant** in 17% of Americans or about 50 million people. You can be 1% German and have a German last name or 99% German and have a Spanish last name but if people mate randomly* the number of people with German last names would be at least as high as the number of people who self-report that they are mostly of German ancestry. There are 80 million Germans and somewhere near that number of Americans with German last names so this quiz becomes somewhat less surprising in hindsight.

* and mate randomly they do. The urge to mate is much stronger than any weak favoritism for ethnic continuity. In the US the idea that like-marries-like doesn't last for two generations (see "My Big Fat Greek Wedding"). And the idea is weakest in the majority (aka white people). Growing up I was amazed that the O'Dea kids down the street were 100% Irish. They weren't recent immigrants so the only thing in my mind was: wow, what are the odds?

If you want another anecdote, here's one: my father's father (who's last name I have, obviously) did not like the Pennsylvania Dutch ("Dutch" being the popular corruption of "Deutsch") . He was a 3rd generation New York German but he didn't care for the country bumpkin Pennsylvania Germans who got on a Westward boat 10+ generations before his own ancestors. His bias was entirely theoretical and limited to jokes and stereotypes. He didn't consider my mother (100% Dutchy) or any of her family as "Dutchy" because they were doctors, lawyers, businessmen, and engineers. He was encouraged to not bring it up and everyone else was reminded that he didn't really mean it. "Etlay itway opdray" is our family motto so this was rarely a problem.

** German ancestry is a plurality but thankfully English/Scottish law is dominant. At the time of the Constitutional Convention in Philadelphia, Pennsylvania the dominant language in Pennsylvania was actually German. Those German speaking Americans were not parochial, however, they voted to make English the official language of the state.

NB, if you ever read a story about harsh race relations in America please take my grandfather's story into account. My grandfather's rhetoric far exceeded reality. His words (accurately quoted!) would have been an indictment but were far different than his beliefs in practice.

Tuesday, July 22, 2008

QOTW

I suspect you've spent too much time using Python when you start calling C variable assignments "mutations" ;-)

Fredrik Lundh in a thread at Ned Batchelder's blog.

Friday, July 11, 2008

ICFP at a Glance

This years problem is simple and very very hard (otherwise it wouldn't be much of a contest). It is a hard path finding problem with time constraints like many past years. Unlike recent years the problem doesn't favor big teams or teams with lots of CPU power. OK, it favors them a little but not much.

The problem is to write a "Mars Rover" control program that communicates over a TCP/IP socket and receives and sends messages with a small real-ish time delay (around ~100ms). All submitted programs will run on the same hardware so the team with the best algos will likely win.

Bob is out but I'm still sticking to the bourbon and steaks theme. I spent an hour on the porch reading and interpreting the problem. And I brought some friends:



Beside Huey, Duey, and Louey are the printed problem description, a fifth of Bulleit bourbon, my engineering notebook, and a trusty Uni-Ball Roller (blue).

If it doesn't violate the rules ... here is how I'm approaching the problem for a first draft:
* ignore the delay in sending commands
* treat all boulders and craters as square
* treat hostile martians as immobile boulders

As the joke goes a Physicist was asked to guess how much a horse weighed and said "Well first we assume the horse is a sphere..." Good enough for a first estimate.

You will notice that I'm a good sport - the rubber bands have been cut on the lobsters. Also, lobsters aren't a big deal in Boston. They cost $8/lb (similar to luncheon ham) so what would be extravagant in land-locked Iowa costs just $30 here.

The problem has a bunch of complicating quirks, of course. It may be profitable to crash into a boulder to slow down and on some maps it may be best to suicide as quickly as possible because of the scoring system. 20 grad students spent a month designing the problem so I'm sure more subtleties will out. Bastards.

Aside I should have mentioned that I went bowling before food shopping and the problem was published. 152, 159 - not good but not terrible considering I was jet lagged and I was a week out of practice. Plus the lanes were messy (that's my excuse and I'm sticking to it).

ICFP 2008 Starts NOW

The ICFP programming contest starts in a couple hours. I have done it the past five+ years and care enough that I flew back from EuroPython early just so I could participate. Unfortunately my usual compatriot Bob (an Electrical Engineer) has been sidelined by an illness. This is a double blow because not only do I not have a second, our normal weekend of beers and grilling (really $50 bottles of bourbon and Omaha Steaks) is off.

I'll be doing it anyway but with a reduced level of fun (and likely success). If anyone reading this wants to participate let me know. I'll be running a bzr repository and depending on the problem (which changes by year) the code will be somewhere between 90% python and 90% C.

Foord, Brandl? I'm looking your way.

I've been meaning to publish my contact information for a long time; John Patrick has been a big deal at IBM for a long time and published "Net Attitude." He makes all his contact information (phone, IM handle, etc) publicly available and swears that is no more than a nuisance. Previously my information was unpublished and the biggest nuisances were head hunters and telemarketers. To put it a different way: all the annoying people already can find me, so why not make it public?

So if you are looking for semi-serious team for the ICFP contact me at jackdied@gmail.com or 617 821 1734 ('mercian). If you're in Boston there are a few wifi enabled cafes/bars/restaurants where we could collaborate.

3 hours until the problem is published.

Thursday, July 10, 2008

EuroPython Errata

Hettinger used tinyurl URLs in all his presentations to give short URLs to resources like CPython source code. Unfortunately I miss-typed a '3' into an 'E' and landed on a gay porn page. This wouldn't have been a problem but I was sitting in the front row and the room lights were out so my screen was BRIGHT. I couldn't just close the page because it had popups, I had to bookmark it first, etc.

The price of a con varies but costs about the same as a vacation. For EuroPython the plane ticket from Boston to Vilnius was $1400 ($600 for the airline, $800 in taxes!), conference hotel was 100 euros/night, walking-around money was $60/day. If you plan ahead (which I did not) you can save money on everything but the airfare. Some of the attendees stayed at a hostel (15 Euros/night) or rented an apartment (50 euros/night). Food and drink prices vary by city: PyCon Chicago was about $100/day, and the Iceland sprint was about $200/day. You can avoid that by buying food and drink at a supermarket which are reachable by public transport. Conventions are vacations for me so I voluntarily spend quite a bit around town.

Vilnius was unusually cheap. The public bus from the airport cost 1.10 litas (about $0.30 US). I thought the hotel was unusually cheap - the venison (deer) plate was 35 litas ($11 us) and 0.5 liters of beer 9 litas ($3 us). The hotel was expensive - prices in town were around 25 litas for a meal and 4.5 litas for a beer.

Conferences should have water and coffee available ALL THE TIME. The PyCon organizers tried to do this but the hotel staff sometimes cleared the service. At EuroPython coffee was available all day but water only rarely; the hotel had no water fountains, none at all (are water fountains an American thing?).

Vilnius is not a wealthy country. Our hotel seemed to be the center of the "jet set" for Lithuania. The casino in the hotel basement was full of locals spending flashy money and the stip club across the street the same (so I am told).

Bars close whenever they feel like, as do restaurants. We had to leave a diner/breakfast place at 7am because they were closing. The casino was open 24 hours a day but to get in you must give them all your information and they take your picture. I think I mostly thwarted them with my state drivers license and a bad picture. I didn't gamble - the rest of the hotel barstaff went on strike but the casino did not.

A Vilnius taxi ("taksi") costs twice as much if you hail one on the street instead of calling. This is the local law. So if you need a cab have the hotel call one for you.

I was worried about attendees English (mostly for my presentation). The ESL (English as a Second Language) English was as good at EuroPython as at PyCon. Also, the material being technical python stuff most of the written content is understandable even if you don't speak the language (I can read Brandl's PyPy talk just fine and I know zero German).

PyCon is about 3/4 American and 1/4 other. EuroPython was the reverse.

If you are standing in a group of people and two of them have speaker's badges then ALL of them will have speaker's badges. This isn't because of elitism; it is because the speakers tend to speak everywhere so they already know each other.

Wednesday, July 9, 2008

Class Decorators: Radically Simple

The slides for my presenation are now online: Class Decorators: Radically Simple. Hopefully the pdf export worked OK.

The talk went reasonably well but I went a bit too fast and finished in 20 minutes instead of 25. I did have a full room.

Update Christ on a crutch and other blasphemies - The talks weren't recorded but I turned on my video camera and left it next to me on the desk. The audio was pretty good and oh boy - I really talked much too fast. I need to master talking in front of 150 people at the same speed that I talk to five.

I also dislike what my voice sounds like on tape, but that is a normal thing. Also, most people can't expect to be as sonorous ss Alex Martelli (an Italian with a booming voice and a English diction that would put most teachers to shame).

Saturday, July 5, 2008

Off to EuroPython

My flight out of Boston leaves in a few hours. I'll be arriving in Vilnius on the 6th at 2pm (Lufthansa 3252). If you see me in the Airport I'll be the tall redhead with a Lithuanian phrasebook in one hand, looking all American-y.

(short hair and no mustache again, like PyCon2007 and not like PyCon2008)

later: "looking all American-y" didn't work out. The Lufthansa stewardesses spoke English to the English, French to the French, but German to me. Sure, I am more than half genetically German (and I look it) and .. I didn't exactly dissuade them by answering "coffee, ja" when the drinks cart rolled around, after she had said something unintelligible to me that must have been "something to drink?"

Sunday, June 8, 2008

See You at EuroPython

My talk was accepted for EuroPython so I'll be invading Lithuania July 7th-12th (probably arriving on the 6th and leaving on the 13th to blunt the jet lag).

Unfortunately this conflicts with the 2008 ICFP contest on the 11th-14th. In past years (2007 writeup) I've done the ICFP as a long weekend steak and beers hack-a-thon with friends. Maybe we can get a BoF going at EuroPython.

Doh, Lebowskifest is that weekend too.

Wednesday, May 21, 2008

Boston Python Life

I still haven't been to a Cambridge python meetup in a long time and I just blocked Wednesdays again by signing up for a bowling league that night. A man has to have his priorities.

Will G's Nomadic Computing Herd now has a schedule. I've worked with Will on open source projects in the past and lived five minutes away from him for years but we've never met. Doug Napoleone quipped at PyCon "I travel 1000 miles to see people that live next door." Exactly (Doug also lives five minutes away and I hadn't seen him since last PyCon).

EuroPython, Maybe

I submitted a talk proposal for EuroPython. It is a longer version of the lightning talk I didn't give at PyCon (slots filled up really super early).

If it is accepted I'll be in Lithuania. I would like to go regardless but PyCon cost 2k+ and because the Fed has been printing dollars for the last 20 years I suspect a trip to Europe would cost even more than that.

Saturday, April 12, 2008

Shell Count Meme

history | awk '{{a[$2]++) END(for(i in a) {printf "%5d\t%s\n", a[i], i))' | sort -rn head

awk: line 1: extra ')'
awk: line 1: missing ( near END
awk: line 1: extra ')'
awk: line 2: missing } near end of file

Take that!
(actually I use tcsh which doesn't keep history between invocations. So this output is as interesting as it gets)

Sunday, March 23, 2008

Misc from PyCon II

I wasn't active on the Pycon-organizers list this year but this game suggestion did get some laughs at the python-dev core sprint. So I give you:

German, American, or Other?


(All of these guys have svn commit privs on the core, as listed here)



Hettinger: American
Brandl: German
Lundh: Other (Swedish)
Reifschneider: American
Doerwald: German
Diederich: American (my great^8-grandfather was German)
Martelli: American/Other (originally Italian)
Dalke: American
Kuchling: Other (Canadian)
Ronacher: German
Warsaw: American
Janssen: American
Heimes: German
Tismer: German
Goodger: Other (Canadian)
Wolever: Other (Canadian or just in Canada?)
Forsberg: Other (Swedish)
Yoshida: I have no idea but I'm hoping this is a trick question
Stein: American
Niemeyer: Other (Brazilian)
Seutter: Other (Canadian)
Kaiser: German (?)
Gustaebel: German
Lemburg: German
Loewis: German
Klose: German
Norwitz: American
Schemenauer: Other (Canadian)
Oussoren: Other
Heller: German
Wouters: Other (Dutch)
Seilnacht: Other
Petursson: American (probably, he speaks fluent Icelandic but I think he converted as a youth)

[highlight the text after the ':' to see the answer]

No doubt there are some errors in there so please leave corrections in the comments. Google isn't great for determining nationality and I didn't even google the answers I already "knew." Also, apologies to any Austrians who got lumped in with the Germans (a friend's grandmother at the age of 90 told her son she was Austrian after saying she was German for a lifetime. When confronted she replied "German, Austrian, whatever.")

Update (July 27, 2008) German ancestry is dominant in 17% of Americans or about 50 million people. You can be 1% German and have a German last name or 99% German and have a Spanish last name but if people mate randomly* the number of people with German last names would be at least as high as the number of people who self-report that they are mostly of German ancestry. There are 80 million Germans and somewhere near that number of Americans with German last names so this quiz becomes somewhat less surprising in hindsight.

* and mate randomly they do. The urge to mate is much stronger than any weak favoritism for ethnic continuity. In the US the idea that like-marries-like doesn't last for two generations (see "My Big Fat Greek Wedding"). And the idea is weakest in the majority (aka white people). Growing up I was amazed that the O'Dea kids down the street were 100% Irish. They weren't recent immigrants so the only thing in my mind was: wow, what are the odds?

If you want another anecdote, here's one: my father's father (who's last name I have, obviously) did not like the Pennsylvania Dutch ("Dutch" being the popular corruption of "Deutsch") . He was a 3rd generation New York German but he didn't care for the country bumpkin Pennsylvania Germans who got on a Westward boat 10+ generations before his own ancestors. His bias was entirely theoretical and limited to jokes and stereotypes. He didn't consider my mother (100% Dutchy) or any of her family as "Dutchy" because they were doctors, lawyers, businessmen, and engineers. He was encouraged to not bring it up and everyone else was reminded that he didn't really mean it. "Etlay itway opdray" is our family motto so this was rarely a problem.

NB, if you ever read a story about harsh race relations in America please take the last paragraph into account. My grandfather's rhetoric far exceeded reality. His words (accurately quoted!) would have been an indictment but were far different than his beliefs in practice.

Thursday, March 20, 2008

Bonus PyCon Day!

I was supposed to fly back to Boston tonight after a successful PyCon but the fates intervened. Or United Airlines sucks - take your pick.

Well, United isn't entirely useless because they did manage to get my bags to Boston. Bastards.

I do get to sprint for an extra day and I was able to get a room in the conference hotel. Joe, the all knowing bartender, says that the airlines booked a block of 250 rooms here for tonight. It should be a pretty ecclectic and angry crowd at the bar.

Update: I made it home the next day (Friday) but last I saw David Goodger his flight was canceled and he was expecting to get out Saturday. From the customer service lines at the airport David probably had some company.

NB, perhaps my mistake was traveling without a towel. That's like asking for trouble.

Tuesday, March 18, 2008

Misc from PyCon I

Don't stay at the Double Tree (the hotel next to the conference hotel) and if you own their stock sell now. I was impressed when checking in because they gave me a hot cookie (that is not a euphamism). I asked about it and they pointed out the OVEN behind the counter. I thought these people really have their shit together - even thouogh I didn't want a cookie. But the clocks in every room were wrong by an hour. Worse, the clocks are set by a radio signal and have no way to manually set the time. The hotel knows about the problem but isn't trying to fix it. That hour is because congress, in its infinite wisdom, wanted to save us all money at no expense to themselves by screwing with Daylight Savings. Congrats congress: you have cost three hundred million people five minutes of inconvenience a week for a year and counting.

Do stay at the Crown Plaza (the conf hotel). It has some rough spots - the bar doesn't open until 4pm - but has fewer signs of dysfunction than the Double Tree. I left a book in a common area yesterday and today asked a waitress if they had found it and saved it. She told me they had found one book but asked me to describe it instead of showing it to me. It turns out I had used a $20 bill as a bookmark and they wanted to make sure they had the right guy first. Actually I had two book marks in there and the other one was a plane ticket stub. Another employee had left a message for me at the desk. So yeah, the Crown Plaza franchise might be average but the local staff are honest and hard working.

Monday, March 17, 2008

PyCon Core Sprints

Sprints have started. The core python sprint has 30 guys this year which is huge (about 12 are core committers). The Django sprint is maybe twice that size. Thankfully no one has revoked my privs since last year even though I haven't committed anything in ten months.

First I'll be investigating PEP 3115 (Metaclasses in 3k). I tried some of the syntax yesterday and couldn't get it to work so either the implementation or the PEP is off. It's probably the PEP in which case my first checkin will be a doc fix.

Sunday, March 16, 2008

PyCon is Over

Well, the main conference anywawy. I'll be around for sprints.

I prepared a lightening talk but didn't get to do it (the talks were a bit disorganized and the slots were full instantly). Mine would have been on class decorators in python. Originally it was titled "in python 3000" but someone back ported decos to 2.6 recently. A pdf of the slides is available here. Most of the content was to be spoken so the slides are sparse.

Tuesday, March 11, 2008

See You at PyCon

I thought I procrastinated last year -- but a friend just asked me what I was doing for St Patrick's day and I said *!#@(*%. The good news is that this morning I was able to book a hotel room and a flight. The bad news is that I couldn't get the conference rate at the hotel and I have to stay next door on the 13th. Live and not learn, I always say.

If you are looking for me I look pretty much the same as I always have, but mustachier.

Tuesday, February 19, 2008

Holy PyCon!

I just tried to register for PyCon (and failed, the fraud detection hates me apparently). The shocker is that I was reg number 585 and the early bird period hasn't even ended! Undoubtedly some of those were test registrations but still - this should be a much bigger PyCon than the previous one which was also record setting.

See you in Chicago! (I'll be staying for sprints too)

Sunday, January 20, 2008

Boston Python Life

My old habit of missing Boston python meetups for no good reason is over. I'm now in a Wednesday bowling league so I have a good reason.
Or a reason, anyway.

The Wingware hosted Boston-PIG list seems dead. There was some shuffle when the Boston group became the Cambridge group. I think there is a Plone group too which is sometimes the same people. Maybe Doug could clear that up.

Will Guaraldi's Nomadic Telecommuting Herd occasionally meets across the street from me. Maybe I'll run into them sometime (but they don't have a schedule, so that's hard to do).

Monday, January 14, 2008

In The Beginning

This is the story of how I started using python.

Out of college I was a well indoctrinated C++ guy. My resume had silly goals on it like "desires to work at a CMM level 3 or higher organization." It was the mid 90s so I ended up working at a C++ based dot com instead (Musicblvd and later CDNow). I left two years later with my youthful enthusiasm for the "correct way" way stripped. It was now the late 90s and my next job was working at a Perl based dot com in Boston (OpenAir). Things were just so much easier with Perl. And everything was different: OpenAir didn't have a single machine that cost over $5k whereas Musicblvd had more than one that cost over $1Mil (a fully loaded E10k ran the database*). Release cycles were monthly instead of annually. Everything was so plainly better and more productive it wasn't even funny. I was no longer a C++ guy.

So when I quit during the bust in 2001 to start my own company I wanted to use perl. I was afraid to for legal reasons so I started casting around for another "P" language. We did the prototype in PHP. The prototype worked but the code was ugly and slow. Python had some buzz so I downloaded that and translated our small app from PHP to Python. The resulting code was a third smaller, easier to read, and ran faster. If that wasn't enough the C guy in me loved the Python core. Compared to Perl and PHP the Python core was simple, clean, and without much baggage. I was sold.

It is many years later and I'm still happy with Python. I have even added one new feature to python (class decorators) and of course, one bug too.


* and that 256 processor Sun wasn't infallible. When it crashed (which it did) Sun helicoptered in tech support and basically paid us off not to talk about it.

Sunday, January 13, 2008

Three Flavors of mod_*

Ian Bicking talks about the conceptual flavors of web deployment. Go read that because this post is only tangential to his point.

Under the Apache 1.x series I have used mod_perl, mod_php, and mod_python. All three do things slightly differently with regards to loading code. Keep in mind apache 1.x only uses the pre-forking model so each request handling process starts life as an exact copy of the root process. The root process's main job is to spawn child processes. [everything below was true in 2000 and for apache 1.x. Don't make decisions based on my recolections unless you plan on running some ancient servers.]

mod_perl allows you to preload scripts when the root process starts. This means no matter how large your code base you only have to compile and execute it once and then every child process starts life with the same initialized modules already in place. At a perl-based company where I worked the preload script was a single line
    use Everything;
The 'Everything' package loaded, well, everything (is this a standard perl-ism nowadays?). Everything.pm was the most delicate module in a large code base. It imported all the packages in the code base in a way that avoided cycles. As a downside the server couldn't use apache's "graceful" restart because the root server didn't have a way to unload the perl runtime and reload Everything. Besides reloading everything was slooow on the 400MHz CPUs of the day. The work-around was to have a proxy server that could point to one of two local ports that ran mod_perl. To gracefully switch the unused app server was stopped and restarted and the proxy was repointed to the new local port.

mod_php is a bit of yuck by comparison. Or a joy for the reasons Bicking states. The yuck is that mod_php compiles and executes scripts anew on every request. This is great for shared hosts as it acts like CGI but with less overhead because it doesn't have to fork on every request. This sucks for application servers that know they want to run the same code over and over again. It gets worse when the codebase is large and there is a package like Everything.pm that loads the entire codebase of a good sized application on every request [yes, this post is somewhat autobiographical].

mod_python is somewhere between mod_perl and mod_php. The first time a child handles a request it pays the price of loading and executing a script. After that all requests handled by the child are quick because sys.modules still contains all the modules loaded by previous runs. mod_python could support preloading modules in the parent process like mod_perl with a trivial patch [see the mod_python archives circa 2001 for the patch I submitted] but it was decided that the security risk (because the parent process usually starts as root) outweighed the benefit of child nodes having a longer startup time.

In conclusion I would urge you to read the source of the mod_whatever for the language you use. They are small and all work give-or-take the same. It also gives you some idea of how the internals of your favorite language work. My first trip was into mod_perl and I found it readable but with a lot of baggage. When I read mod_php I thought "what a hack! Is this broken on purpose?" Finally I read mod_python and with my perl background I was aghast at how simple and clean the interpreter related code was.

See you at PyCon!