[redland-dev] Storing statements in a Python dictionary doesn't seem to work

Dave Beckett dave.beckett at bristol.ac.uk
Thu May 15 12:25:16 BST 2003


On Thu, 15 May 2003 11:51:36 +0300
"Carlos.Guerreiro" <Carlos.Guerreiro at nokia.com> wrote:

> Hi Dave,
> 
> Thanks for the clarification. My bad, I should have read the docs
> carefully...
> 
> But anyway, shouldn't Python's reference counting semantics be
> enough to handle this sharing efficiently, without ever requiring a
> copy? 
>

The python object - yes, but it wraps a shared Redland object that is
re-used by the underlying iterator so that it doesn't keep needing to
copy objects.  Nice and efficient but python doesn't know about it,
so if Python thinks it has increased the reference count to that
object, it doesn't know that the contents of the Redland object
underneath has changed.

I'm increasingly thinking I'll have to throw out the efficiency for
perl, python and higher level language interfaces since they interact
badly with that.  (The alternative of hard-coding in C ALL the
python/perl/.. list/sequence/generator/iterator semantics is rather
too much work to think about).

If I do that, it should mean these things just work and you don't
have to think so hard about when to copy, which is a good thing.
The result is probably less mysterious crashes, also good.

Dave





More information about the redland-dev mailing list