[XML-SIG] DOM API

Paul Prescod paul@prescod.net
Tue, 20 Apr 1999 11:11:15 -0500


Fredrik Lundh wrote:
> 
> the downside with Paul's line of reasoning is that it makes it
> impossible to come up with something that is light-weight
> also from the CPU's perspective...  not good.

That isn't true. I tend to think that usability is more important than
performance but if we decide to optimize for performance then we can make
a DOM-compatible API that is as fast as "qp". I mean the only thing that
is harder to implement in the miniDOM is siblings -- where I chose
convenience over efficiency. We can make the opposite choice.

In fact, I think that the namespace and language support in qp already
makes it relatively "heavyweight".

> I want something really light-weight, and highly pythonish, and I
> don't care the slightest about TLA compatibility.

It isn't a question of TLA compatibility. It's about using the data models
used everywhere else in the world. Python conforms to posix conventions
for file and socket operations, C conventions for string interpolation,
Perl conventions for regular expressions, Unix conventions for globbing
and so forth. If I wanted idiosyncratic invented-just-for-us interfaces I
would go and use Perl. 

To me, this is the central issue: to me, the Guido's genious lies in the
fact that he usually chooses adapt something before re-inventing it. This
makes learning Python easy. "Oh yeah, I recognize that from the other
languages I use." Well, SAX and DOM are what the other languages use.

Anyhow, "qp" is hardly more "Pythonic" than in the lightweight DOM API.
The following_cdata stuff is not like any API I've ever seen in Python or
elsewhere. The call for "pythonic-ness" is mostly a strawman. The DOM
works better in Python than in almost any other language: Nodelists are
lists, NamedNodeLists are maps, object types are instance classes, lists
can be heterogenous, etc.

-- 
 Paul Prescod  - ISOGEN Consulting Engineer speaking for only himself
 http://itrc.uwaterloo.ca/~papresco

"The Excursion [Sport Utility Vehicle] is so large that it will come
equipped with adjustable pedals to fit smaller drivers and sensor 
devices that warn the driver when he or she is about to back into a
Toyota or some other object." -- Dallas Morning News