Friday, March 25, 2005

The rest of PyCon, day #2

I spent much of the afternoon at the lightning talks that Greg mentioned, and they were great fun. The two things that struck me most were:
  1. The fact that one or two people can hole themselves up for a while, churn out a bunch of Python code, and generate some pretty cool hacks (a userspace NFS fileserver, a really neat threaded email viewer, etc. etc.)
  2. The incredible warmth of the community. Person A might not care too much about web stuff, but he or she is still genuinely excited and supportive when Person B gets up to give a 5 minute lightning talk on his/her Python web templating library.
After the lightning talks, I went to three more heavy-duty, guts-of-the-language type talks. Two were by Alex Martelli, and the third was from Mike Fletcher.

Alex's first talk centered on descriptors, decorators, and metaclasses. It seemed like a great 1-hour talk that had been squeezed into 20 minutes; if (like me) you didn't know much about descriptors before the talk, then it probably would have made you curious to learn more, but there just wasn't time to absorb much of what Alex was saying.

Alex's second talk was a much more accessible spiel about generators and iterators. Alex took us smoothly from introducing basic generator syntax up to introducing more complex, nested generators for things like tree traversal. He also made a great pitch for itertools, citing its elegance and high-level nature as a motivation for many people, and the fact that itertools are fast as a great motivation for the remaining, more pragmatic Python programmers. :)

Mike's talk also focused on descriptors and related language constructs, but some technical difficulty with his slides made things a bit tough. I did have a chance to speak with Mike for a while in the evening, and when I was praising the Traits talk from the day before, he mentioned a few other projects that are doing similar things (many of them using descriptors). He pointed me to wxOO/BasicProperty/BasicTypes and PEAK, and he said that Zope had something along those lines as well. (I might be forgetting one more). Mike had personally worked on the wxOO project, and he said that BasicProperty and BasicTypes had some web support, which is something that's currently missing from Traits.

1 comment:

Peter said...

Traits is interesting because when people are first exposed to it, they tend to fixate on the pseudo-typing aspect of it:

class Foo(HasTraits):
x = Int()
y = Range(0,10)
z = List()

I think this style of syntax is shared by several other projects (e.g. most ORM libraries), and wxOO even bears resemblance to Traits's UI generation feature.

But I've found that in practice, the most powerful aspect of Traits is the ability to easily write code in the reactive programming style. When I can easily create objects that bind and respond, at runtime, to changes in other objects, it completely changes around how I express the logic in my programs. It naturally becomes much more model-centric, and separation of models, views, and controllers tend to fall out of the design.