[SciPy-user] array like circular buffer?

John Hunter jdhunter at ace.bsd.uchicago.edu
Thu Oct 27 17:19:35 EDT 2005


>>>>> "skip" == skip  <skip at pobox.com> writes:

    John> I would like to have a fixed size array like data structure
    John> that has circular buffer semantics.  Eg, when empty you can
    John> call a "put" method that starts in the beginning and fills
    John> the sucker up, and when you overflow the end it starts
    John> pushing the data from the 0 index off the stack -- FIFO.
    John> Ideally, it would support slicing and friends.

    skip> How about subclassing list and proving relevant methods that
    skip> adjusted all indices by modulo the list length?

I was hoping/guessing someone had already done it for me <wink>

JDH




More information about the SciPy-User mailing list