Python declarative

Rustom Mody rustompmody at gmail.com
Sun Jan 26 09:36:25 EST 2014


On Sunday, January 26, 2014 2:42:57 PM UTC+5:30, Frank Millman wrote:
> "Rustom Mody"  wrote:
> > Xml, originally a document format, is nowadays used as a data-format.
> > This conduces to humongous messing, first for the xml-library writers, and
> > thence to the users of those libraries because library messes inevitably
> > leak past abstraction barriers to cause user-programmer headaches.
> > tl;dr
> > Frank's principle: "Express little as possible in <programming language>"
> > is correct.
> > "And therefore XML is the solution"
> > is bad logic
> > [Unless <programming language> == "java" !]

> If that is the case, what is 'good logic'? JSON or YAML?

> It does not make much difference which format I use. However, I will say 
> that I found it a useful discipline to create an xml schema to describe my 
> form definition, for two reasons.

> Firstly, I was hand-crafting my form definitions initially, and as I added 
> features it became unwieldy. Forcing myself to create the schema highlighted 
> a lot of anomalies and I ended up with a much cleaner structure as a result.

> Secondly, it has picked up a lot of errors in the resulting documents which 
> would otherwise have generated hard-to-find runtime exceptions.

There are json/yaml 'schema'* validators if you want eg
https://github.com/alecthomas/voluptuous
http://rx.codesimply.com/

* if you want to call them that!



More information about the Python-list mailing list