Here is a comment on the paper "Programming with Circles, Triangles and Rectangles" by Erik Meijer, Wolfram Schulte and Gavin Bierman. Google will find it quickly if you try.
In the paper they introduce Xen, an extension to C# for better XML support. They show how Lifting, Filtering and Apply-to-all can be done so much better in C# with Xen. How is Python, my favorite programming language, doing in this respect? Let's see: Python for XML ============== Lifting ------- The example: "bib.books.title" [[an expression for all titles of books in bib]] (stuff in double quotes "..." is suggested Xen code from the article by E.Meijer et al., stuff in double square brackets [[...]] is the intended meaning. Python code is shown after >>> , the prompt from the Python interactive interpreter.) We can do this "Lifting" in Python with list comprehension: >>> [b.title for b in bib.books] Filtering --------- The example: "bib.books[it.year >= 1998]" [[An expression for the books from 1998 or later]] This can also be done with Python list comprehensions. >>> [b for b in bib.books if b.year >= 1998] Apply-to-all ------------ The example: "bib.books.{print it}" [[print all books: execute a code block for every book in .books.]] I would do it like this in Python: for b in bib.books: print b looks much clearer to me than the .{...} stuff. Oh and maybe the new generator expressions can be used for this, but they are new to me and I can hardly imagine clearer syntax. Anyone? All that is needed for this to work in Python is that you collect XML attributes in object attributes; and that you give a name to the XML children of an XML element and put them as a list into an object attribute with that name. Go wild and even define new classes for it dynamically, or beforehand if you have the XML DTD or Schema. Not too hard a programming exercise; who is first? As for the other content of the article it is my opinion that they pay way too much attention to data-models and types, and then strangle themselves trying to fit one data-model onto another one, and a statically typed one too for that! (C#, Java, even Visual Basic is mentioned for laughing out loud). Better try to get the job done first. They did this work paid by microsoft.research. I think microsoft.research better pay some more attention to Python. Or are they? Are the "competitive edge" rumors true? -- http://mail.python.org/mailman/listinfo/python-list