Re: Call to arms, language bindings



On Tue, 2006-08-01 at 15:11 +0200, Philip Van Hoof wrote:
> Improve the Python language binding
>   - implementing the sequence protocol

After starting some work on this, I've noticed that a some of the
operations that sequences have are hard to map onto the list/iterator
API.


* "length" maps directly

* "get Nth item" work by creating an iterator, and using get_nth_item.

* "copy" will map directly

* "create iterator" should work fairly well (but I haven't done it yet)

* "concatenate" should be possible by iterating over the second list and
appending to the first (with special handling when they're the same
list).

* "set Nth item" is impossible as far as I can tell. TnyListIface has
append and prepend, but nothing that can change an item.

* "delete Nth item" is impossible as far as I can tell. TnyListIface has
"delete(data)", but doing "delete (get_nth (N))" won't work correctly if
the item is in the list twice.


Cheers,

James "Doc" Livingston
-- 
Prediction is difficult, especially of the future. - Niels Bohr




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