Ben Ramsey

OSCON 2008: Day One

I find myself once again in Portland, OR at the O’Reilly Open Source Convention. This year, I’m giving a talk on memcached. The talk is on the PHP track, but the concepts can apply in any of the other languages represented at OSCON, so if you’re interested in memcached and how to use it, stop by on Wednesday at 5:20pm.

In previous years at OSCON, I’ve stuck mainly to the PHP track. This is because I have a lot of friends who are speakers, and so I’ve attended their talks to learn from and support them. This year, though, I’ve decided to focus on some of the other languages represented here, particularly Python and Erlang. This morning, for example, I attended Steve Holden’s Python In 3 Hours tutorial. Tomorrow, I’ll be attending the Practical Erlang Programming tutorial, and later this week, I’ll get Just Enough C for Open Source Projects.

So, today, one of the more interesting features I learned that Python supports is the concept of closures. Here’s a simple example from the tutorial:

[code lang=“python”]

  1. Closures example

def adder(n):
def add(m):
return m+n
return add

add20 = adder(20)

print add20(2) # should print 22

l = []
for i in range(100):
l.append(adder(i))

print l13(22) # should print 35
[/code]

FYI: There’s been some discussion surrounding a recent patch proposal to add closures and lambda functions to PHP.

At any rate, it’s good to be back at OSCON this year, catching up with old friends, making new friends, and expanding my knowledge of open source languages.

By the way, I’ve brought along with me 10 elePHPants who need good homes. If you want one, it’s yours. You just have to find me in person and let me know. They’re first-come, first-serve.

Comments