Re: Call to arms, language bindings

On Fri, 2006-08-04 at 10:20 +0200, Philip Van Hoof wrote: 
> On Fri, 2006-08-04 at 14:56 +1000, James "Doc" Livingston wrote:
> > * "set Nth item" is impossible as far as I can tell. TnyListIface has
> > append and prepend, but nothing that can change an item.
> You need to use the iterator for this. The list itself doesn't keep a
> position state. That is what you use an iterator for.

Make sense. I wasn't really saying that it needed to be a part of the
list interface, just that (AFAIK) it isn't possible with the current

As you mention the obvious thing is for the iterator to have operations
like "delete" and "set". We would just need to define the semantics of
those operations, and make the implementations implement them.

You mentioned iterator invalidation recently, which is something we'd
definitely have to sort out. To me, the obvious base semantics would be
that the iterator being used for modification must remain valid, but all
others may (or may not) become invalid. Adding a "is valid" operator,
and making the others return NULL[0] when the iterator is invalid are

[0] assuming you aren't allowed to put NULL in iterable things, which I
haven't checked.

> You can of course create one 'default' iterator per list instance. It's
> not clean nor the right thing to do. But if that is what it takes to get
> Python language bindings nice .. I will consider it

I'm fairly certain that wouldn't help - and even if it did, it could be
implemented in the Python binding itself.


James "Doc" Livingston
"Give a man a match and he's warm for a day. Set a man on fire and he's
warm for the rest of his life." -- Terry Pratchett.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]