Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #62001

Re: Wrapping around a list in Python.

From Ben Finney <ben+python@benfinney.id.au>
Subject Re: Wrapping around a list in Python.
Date 2013-12-16 15:59 +1100
References <e8123076-9f52-4a72-b262-908a5dcc8a10@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.4177.1387169987.18130.python-list@python.org> (permalink)

Show all headers | View raw


shengjie.shengjie@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?

> 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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Wrapping around a list in Python. shengjie.shengjie@live.com - 2013-12-15 20:38 -0800
  Re: Wrapping around a list in Python. Ben Finney <ben+python@benfinney.id.au> - 2013-12-16 15:59 +1100
    Re: Wrapping around a list in Python. shengjie.shengjie@live.com - 2013-12-15 21:07 -0800
      Re: Wrapping around a list in Python. shengjie.shengjie@live.com - 2013-12-15 21:10 -0800
        Re: Wrapping around a list in Python. Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-12-16 09:33 +0000
    Re: Wrapping around a list in Python. Denis McMahon <denismfmcmahon@gmail.com> - 2013-12-16 10:12 +0000
  Re: Wrapping around a list in Python. Gary Herron <gary.herron@islandtraining.com> - 2013-12-15 21:10 -0800
    Re: Wrapping around a list in Python. shengjie.shengjie@live.com - 2013-12-15 21:26 -0800
      Re: Wrapping around a list in Python. Peter Otten <__peter__@web.de> - 2013-12-16 10:15 +0100
      Re: Wrapping around a list in Python. David Robinow <drobinow@gmail.com> - 2013-12-16 07:41 -0500
      Re: Wrapping around a list in Python. Dave Angel <davea@davea.name> - 2013-12-16 07:51 -0500
  Re: Wrapping around a list in Python. shengjie.shengjie@live.com - 2013-12-15 21:26 -0800

csiph-web