Wrapping around a list in Python.

shengjie.shengjie at live.com shengjie.shengjie at live.com
Mon Dec 16 00:10:15 EST 2013


On Monday, 16 December 2013 13:07:46 UTC+8, shengjie... at live.com  wrote:
> On Monday, 16 December 2013 12:59:32 UTC+8, Ben Finney  wrote:
> 
> > shengjie.shengjie at live.com writes:
> 
> > 
> 
> > 
> 
> > 
> 
> > > Hi guys, I am trying to create a fixed list which would allow my
> 
> > 
> 
> > > values to be wrapped around it.
> 
> > 
> 
> > 
> 
> > 
> 
> > This doesn't make a lot of sense to me, but I assume you have a purpose
> 
> > 
> 
> > in mind for this. What is the purpose? Perhaps it will help the
> 
> > 
> 
> > explanation if we know what it's for.
> 
> > 
> 
> > 
> 
> > 
> 
> > > For example i have 10 values : 0,1,2,3,4,5,6,7,8,9
> 
> > 
> 
> > 
> 
> > 
> 
> > Does this mean the input is a list, ‘[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]’? Or
> 
> > 
> 
> > do you mean something else? What is the input?
> 
> > > The input is from [0 to 9] however I want a display which displays [0-3] and when the value reaches 3, it replaces the 4th value with the first value and so on.
> 
> > 
> 
> > 
> 
> > > I need to create a list which contains 4 numbers and when the number
> 
> > 
> 
> > > exceeds the list, it would overwrite the first value.
> 
> > 
> 
> > 
> 
> > 
> 
> > > [0,1,2,3]
> 
> > 
> 
> > > [4,1,2,3]
> 
> > 
> 
> > > [5,4,1,2]
> 
> > 
> 
> > 
> 
> > 
> 
> > That's three different lists. What is the input in each case? Under what
> 
> > 
> 
> > circumstances would you expect each one to be produced?
> 
> > 
> 
> > 
> 
> > 
> 
> > -- 
> 
> > 
> 
> >  \     “As scarce as truth is, the supply has always been in excess of |
> 
> > 
> 
> >   `\                                       the demand.” —Josh Billings |
> 
> > 
> 
> > _o__)                                                                  |
> 
> > 
> 
> > Ben Finney
> 
> 
> 
> Im currently creating a logging function for my GUI in pyqt.
> 
> I saved its feedback data values in a .txt file and I access these values by placing them in a list. However, this list gets really big and I am trying to find a work around.




More information about the Python-list mailing list