Python declarative

Terry Reedy tjreedy at udel.edu
Wed Jan 22 23:08:06 EST 2014


On 1/22/2014 9:29 PM, Chris Angelico wrote:
> On Thu, Jan 23, 2014 at 8:16 AM, Asaf Las <roegltd at gmail.com> wrote:
>> i am novice in python, but let me suggest you something:
>> it would be beneficial to use json text file to specify
>> your gui so composite data structure can be created using
>> json and then your program can construct window giving
>> its content will be based on simple text file?
>> You can add every parameter to json encoded window system
>> once your window construction will be using as interpreter
>> for that. JSON is very structured and quite presentable for
>> such kind of things.

> JSON is better than XML for that, but in my opinion, both are
> unnecessary. Python code is easy to edit. (See [1] for more on Python
> and XML.) When you're writing compiled code, it makes good sense to
> drop out of code and use a simple text file when you can; but when
> your code *is* a simple text file, why go to the effort of making a
> JSON-based window builder? (Unless you already have one. GladeXML may
> well be exactly what you want, in which case, go ahead and use it. But
> personally, I don't.) JSON is a fantastic format for transmitting
> complex objects around the internet; it's compact (unlike XML),
> readable in many languages (like XML), easily readable by humans
> (UNLIKE XML!), and can represent all the most common data structures
> (subtly, XML can't technically do this). It's superb at what it
> does... but it doesn't do Python GUIs. For those, use Python itself.

I would only use JSON if I wanted a declaration format that was 
independent of implementation languages, that could be read and turned 
into application objects by as least two languages.

-- 
Terry Jan Reedy




More information about the Python-list mailing list