Which Do You Prefer, and _Why?

This is in response to Greg Borenstein’s article titled A Beginner’s Guide to Practical Syntactic Magic: the tale of Hpricot’s sudo-constructor and Stuart Halloway’s follow-up article, With great power comes great responsibility.

Both articles make reference to the odd method-naming tricks used in Why The Lucky Stiff’s Hpricot library for parsing XML (commonly HTML). In light of those tricks, I have a question for you all…

Which of the following two snippets of code would you:

  • Prefer to read
  • Be inclined to write

This:

With “Syntactic Magic”
1
2
3
doc = Hpricot.parse(open('http://www.atnan.com'))
title = doc.at('title')
articles = doc.search('.entry')

Or this:

Without “Syntactic Magic”
1
2
3
doc = Hpricot(open('http://www.atnan.com'))
title = doc % 'title'
articles = doc/'.entry'

I’m interested in hearing your feedback.