GSoC: Linked List || Blog post by Chetan Karwa || #12

Greetings Everyone,

Progress in the past week:

  • Fixed the issue with concat and slice as APIs.
  • Implemented the absorb API
  • Made a progress report for my project. Request everyone to suggest changes in the report. (link)

Plans for the coming week:

  • Properly comment the whole code for better understanding.
  • Bring in my code into the forked repository of stdlib.

The approach for out of index range input in get() and insert() APIs can be handled by using modulo of the input index.
For instance, if in get() API input index is 12 and the size of the list is 7 then the function returns the item stored at the index 5 (12%7). I ask for other’s views regarding the same.

Thank you.


That sounds like a very surprising behavior. I imagine it would lead to very strange and possibly difficult to find bugs.


If we want to handle out-of-range indices so that they’re never errors I’d suggest that anything > len(list) appends and anything less than 1 prepends. It is possible that some application will want the modulo behaviour but this is a library component so I’d suggest leaving the weird and unusual to the application.

1 Like

It does add a complex behaviour to the API. Therefore, I will keep the API as it is now i.e.

anything > len(list) appends and anything less than 1 prepends

In general: the API should not present any surprises. A bit boring perhaps, but it makes life much easier for the user :slight_smile: