Python uses an index of -1 to index the last element in a list. Since -1 occurs
before 0 we might think of the elements of the linear list are being bent into
a circle making the last element occur before the 0th element. Consider a list
with n elements: it would be perfectly reasonable to addre
As discussed earlier on the post on 'Circular Indexing', considering
interpreting indices that lie outside the range 0 to n-1 modulo n for list
indexing. Thus element n corresponds to element 0, n+1 to element 1 and so on.
This has two consequences:
1.) Makes the Python convention of interpret
If circular indexing is used then instead of using a double FOR loop to go
through a list M times we can iterate from 0 to M*N (where N is the length of
the list) !!!
Almost all Machine Learning (ML) algorithms iterate for some predefined epochs
over a large data-set. So a double FOR loop is e
: python-ideas@python.org; m...@pradyunsg.me
Subject: Re: [Python-ideas] Getting rid of FOR loops and simplifying cicular
conviolutions with Circular Indexing
days_of_the_week[14 % 7]
There ya go!
On Wed, Nov 25, 2020 at 12:51 PM Mathew M. Noel via Python-ideas
mailto:python-ideas@python.org
limited use in uncommon cases. And
that would break literally billions of lines of working code.
If you want the modulo operator, you are more than welcome to use it. If you
want to subclass list, have at it.
On Wed, Nov 25, 2020, 12:48 PM Mathew M. Noel via Python-ideas
mailto:python-ideas@python.o