Sunday, August 08, 2010

"Many Eyeballs" - HA!

Oh, yes, I feel I should record this little incident from PyOhio 2010, for the sake of evidence during Nick's trial.

I used PyOhio's Lightning Talks to give away our swag prizes; and, in the spirit of open-source, I put the code on the projector for everyone to see.

import csv
import random

regfile = open('registrations.csv')
reader = csv.DictReader(regfile)
registrants = list(reader)

def pick():
winner = random.choice(registrants)
return '%s %s' % (winner['First Name'],
winner['Last Name'])

Then I realized that I didn't have the Lightning Talk sign-up board, so I went out into the hall to get it. I was gone maybe 60 seconds. When I got back, I called pick() and got... Nick Bastin!

The room giggled. Nick said, "Wow, that's the first time I've written bug-free code on the first try!" I didn't get it, so he said, "Why don't you pick another winner?"

Nick Bastin!

The nice thing is, my code was intact. However, this was lurking in my directory.

$ cat random.py
def choice(foo):
return {"First Name" : "Nick", "Last Name" : "Bastin"}

The lesson here is: Many eyeballs can help protect you from malicious code... unless they're all in on it!

2 comments:

Michael A. Smith said...

Hilarious. I guess all the pirates aren't equally opportunistic and perfectly rational.

Anonymous said...

Lol...pretty funny. Open-source developers have strange (great) sense of humor.