List slice assignment and custom sequences

Ronald Oussoren oussoren at cistron.nl
Wed Nov 6 01:38:18 EST 2002


On Tuesday, Nov 5, 2002, at 19:26 Europe/Amsterdam, Michael Hudson 
wrote:

> Blindly trusting the answer of PyObject_Length() can easily lead to
> core dumps.  But now Python has this wonderful PySequence_Fast API
> that wraps up all the nasty details while keeping the common case
> fast, so supporting user-defined sequences is now trivial.
>
> Everyone writing C extensions should know about PySequence_Fast().
Interesting, I'll have a look at this API.

>
>> A third answer is inertia.  Python has been moving to a more
>> generalized notion of sequence and even iterable but slice assignment
>> got overlooked -- until you gave a push.
>
> Indeed.

Glad to be of help, even with an awful (and not applied) patch :-)

Ronald





More information about the Python-list mailing list