req: OO SQL gen module?

Kragen Sitaker kragen at dnaco.net
Mon Mar 6 22:29:40 EST 2000


In article <38C42324.49E88846 at roguewave.com>,
bjorn  <bjorn at roguewave.com> wrote:
>Kragen Sitaker wrote:
>> That would be nice syntactic sugar, but you could just as easily say
>> s.where(greater(t['col3'], 5)), couldn't you?
>
>No, that can't be done since Python doesn't let you overload greater on
>differently
>typed arguments like e.g. C++.  I started doing:
>
>    s.where( t['col3'].greater(5) )
>
>but that became exceedingly messy with anything but trivial expressions.

I see.

Still, where you say, "No, that can't be done", I seem to read, "No, I
don't want to pollute the namespace that way".  

I feel less worried about polluting the namespace in Python.  :)

>Note that
>greater(t['c3'], 5) would also quickly become messy if it was allowed,
>and since the
>reason for doing all this in the first place was greater convenience (in
>addition to
>masking quirks in individual databases' sql syntax) I gave it up and
>decided to wait
>until the proper operator overloads were implemented in the Python core.

It is true that greater(t['c3'], 5) is much uglier than c3 < 5.  :)
-- 
<kragen at pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
The Internet stock bubble didn't burst on 1999-11-08.  Hurrah!
<URL:http://www.pobox.com/~kragen/bubble.html>
The power didn't go out on 2000-01-01 either.  :)



More information about the Python-list mailing list