[DB-SIG] Re: [Python-Dev] database APIs

Magnus Lycka magnus@thinkware.se
Tue, 04 Feb 2003 13:36:15 +0100


At 10:20 2003-02-04 +0000, Luke Kenneth Casson Leighton wrote:
>  i believe i described, later in the email to which you replied,
>  that it should be possible to over-ride special cases.
...
>  for example in the display of certain fields in a table,
>  in pysqldb i provide a means to pass in a function to
>  perform the HTML rendering.

Are you only intending to use this for web applications?

With a GUI, there are so many more things you can do, and so
many more requirements that might pop up--and be reasonable--
to implement. You might want to do a lot of things without
roundtrips to the database server.

>  the idea that i had was that the XML file should specify the
>  module and the function name to be used to display the
>  column.

It sounds to me like you don't intend the columns to be aware
of the context they are in. Of course, you can make them aware
though the database, but only if you actually store data.

What if we want a field to get a red background colour as soon
as you enter a value that lies outside the min and max values
that are presented in other columns. Imagine that you want to be
able to change all columns and get visual feedback before you save
data to the database.

In my experience, these kinds of demands pop up sooner or later,
and it seems to me that it would be much easier to solve this
with form-specific code.

Unless I misundersttod you, you intended to use a generic engine
that will use an XML description to find out what fields to
assemble on the screen, and all application specific logic is
tied to a specific field.

> > What is it you can do in XML that you can't to in a structure of
> > nested lists etc in Python?
>
>  you can't get python accepted by perl or php programmers or
>  non-technical administrators.

Ok. Politics can be a tricky issue... You're right about that...

Another option is to get involved in Python Business Forum,
and try to increase the buzz-factor of Python, but it might
be faster to write something in XML I suppose. ;)

ReportLab's rml2pdf is an example of what you say I guess, but
that's limited to creating documents. I think it works better
there than in creating user interfaces.

I wrote:
> > There are certainly a lot of things you
> > can do in Python that you can't easilly do in XML...

Luke wrote:
>  your comments here lead me to believe that you misunderstand
>  what XML is, can, and cannot do.

Well, maybe I was unclear...

>  XML is nothing without meaning being provided.
>
>  it's just a pretty data format.
>
>  XML doesn't run, it doesn't execute, it doesn't sing or dance.

Yes, this is what I meant. (Except possibly the "pretty" part. ;)

>  for XML to have meaning, there must be three things:
>
>  - the data.
>
>  - the interpretation of the data.
>
>  - a program to make use the interpreted data.

The same is true for Python of course. Any source code is just
data. But with python you have a much higher signal / noise ratio,
and you don't have to invent the interpreter or the syntactic rules.
It comes out of the box. I hadn't seen virgule, and I haven't used
XML a lot, but I think I have a general understanding of what's
on the menu. You didn't make me change my mind...

I much prefer the built-in power of python--for the special cases--
even if I try to make as abstract and generic programs as possible.
Then I can fix the special cases that are bound to pop up.

But I suppose you have a point that XML might be easier to
get acceptance for than Python. :(


-- 
Magnus Lycka, Thinkware AB
Alvans vag 99, SE-907 50 UMEA, SWEDEN
phone: int+46 70 582 80 65, fax: int+46 70 612 80 65
http://www.thinkware.se/  mailto:magnus@thinkware.se