meta language to define forms

Roy Smith roy at panix.com
Fri Mar 28 04:13:21 CET 2014


In article <mailman.8653.1395975737.18130.python-list at python.org>,
 Chris Angelico <rosuav at gmail.com> wrote:

> On Fri, Mar 28, 2014 at 7:56 AM, Sells, Fred
> <fred.sells at adventistcare.org> wrote:
> > I don't have a lot of time or management support to do something elegant 
> > like XML and then parse it, I'm thinking more like
> >
> > Class  FyFormNumber001(GeneralForm):
> >         Section1 = Section(title="Enter Patient Vital Signs")
> >                 Question1 = NumberQuestion(title="Enter pulse rate", 
> >                 format="%d3")
> >                 Question2 = Dropdown(title="Enter current status")
> >                 Question2.choices = [ (1, "Alive and Kicking"), (2, 
> >                 "Comatose"), (3, "Dead"), ...]
> 
> Rule of Python: XML is not the answer. XML is the question, and "NO!"
> is the answer :)

The nice thing about that rule is that it ports easily to so many other 
programming languages.  Except possibly Java.  Java and XML seem to be 
made for each other.
 
> Your syntax there looks reasonable already. I'd recommend you make it
> a flat data file, though, don't try to make it a programming language
> - unless you actively need it to be one. Here are a couple of ways you
> could format this. Any would be fairly easy to code a parser for.

My first impression here is that YAML might work here.



More information about the Python-list mailing list