Slicing up to 15 items after a certain item in a python list

I'm trying loop through a list in python and compare each element in the list to the next 15 elements in the list. I want something like the following code, but I don't know how to say it in python. Also, I want to do it without importing anything extra.

for i in S:
    for j in S[i: '''up 15 elements after i or however much is left if less than 15''']
        #do some comparisons

So basically, for the inside loop, I only want to iterate from item i to item i+15 (or whatever is left), without importing iterator or such.



Use an index:

for index, i in enumerate(S):
    for j in S[index+1:index+16]
        #do some comparisons

Need Your Help

Good Resource Loading System

flex actionscript-3 resources

I'm currently looking for a resource management system for actionscript3. More specifically in this case, I'm looking for opinions on off-the-shelf resource loaders/managers from people who have used

Include quadratic terms in Deducer's Linear Regression Model Builder

r linear-regression deducer

What should I do in Deducer's Linear Regression Model Builder to produce a formula like the following

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.