Archive for June, 2009

XML The Evil Adult

3

Entertaining if long winded rant from Erik Naggum:

When the markup overhead exceeds 200%, when attributes values and element
contents compete for the information, when the distance between 99%
of the “tags” is /zero/, when the character set is Unicode, and when
validation takes more time than processing, not to mention the sorry
fact that information longevity is more /threatened/ by XML than by
any other data representation in the history of computing, then SGML
has gone from good kid, via bad teenager, to malfunctioning, evil
adult as XML.

Python Simple Mock Object

0

Another one of those that’s mainly for my own notes. I needed to create a mock object that always a returns an empty list no matter what method is called on it. That is, you can instantiate one of these and call any made up method on it and get an empty list back. Here is it:


class Dummy:
	def __getattr__(self, name): return lambda *args: []
d = Dummy()
d.something()   # returns []
d.something_else("a",1,"b")   # returns []