Reciprocal data structures

Christopher Reimer christopher_reimer at icloud.com
Mon Jun 19 07:21:12 EDT 2017


> On Jun 18, 2017, at 11:02 PM, Chris Angelico <rosuav at gmail.com> wrote:
> 
> On Mon, Jun 19, 2017 at 3:54 PM, Steven D'Aprano <steve at pearwood.info> wrote:
>>> With a list? No, I would say it's a bad idea.
>> 
>> 
>> Why a bad idea?
>> 
>> As opposed to "can't be done", or "too hard and slow".
> 
> Maintaining a record of list indices inside an object, with the
> specific proviso that:
> 
>> If the list is changed, the list updates the indices.
> 

A linked list with pointers to the next and previous items?

If this was a homework problem, a linked list is usually implemented in C. The list keyword in Python is not the same thing.

Chris R.


More information about the Python-list mailing list