On 20/09/2012 02:18, Daniele Varrazzo wrote:
>>> - Possibly it should support an "in" operator and an & operator. But
>>> >> then, should we mimic all the operators?
>>> >> <http://www.postgresql.org/docs/9.2/static/functions-range.html>
>>> >> Probably not.
>> > By "&" do you mean "&&"? Part of me thinks we should support overlaps, but part of the power of the range types feature is that Postgres can handle overlap operations (which are nontrivial to build). I see "in" being used a lot.
> There's no && operator in python. But you are sorta right: I was
> thinking about an operator saying if two intervals match, not to
> return their intersection. But would it be any useful? It's definitely
> little thing compared to the richness of the postgres range type and
> implementing all of them is a project on its own. "in" otoh would be
> easy to implement.
After we have a basic range type we can add operators as methods (IMO,
in this case operator "overloading" in Python is not what we want). So
you can have:
and so on. "in" can be an alias for one of such methods.
In fact a range type is so useful that I am amazed it doesn't already
exists in Python.
Federico Di Gregorio federico(dot)digregorio(at)dndg(dot)it
Studio Associato Di Nunzio e Di Gregorio http://dndg.it
Qu'est ce que la folie? Juste un sentiment de liberté si
fort qu'on en oublie ce qui nous rattache au monde... -- J. de Loctra
In response to
psycopg by date
|Next:||From: Tobias Oberstein||Date: 2012-09-20 21:50:46|
|Subject: flexi adaption/casting scheme|
|Previous:||From: Daniele Varrazzo||Date: 2012-09-20 00:18:50|
|Subject: Re: Range Type Support|