While implementing Matrix multiplication for university, I eventually got a 3 times nested for-loop, using only ranges. I personally do not like nesting and asked myself if there is something in Python that could "simplify" the syntax of this special case.
I looked that up in the internet but unfortunately i was not able to find anything.
The code I got looked somewhat like this:
for i in range(a):
for j in range(b):
for k in range(c):
# some stuff
With Python being able to return multiple values I thought there should be some iterator returning N indices of N nested range-using for-loops, like:
# this should do the exact same thing like the above example
for i, j, k in nrange((a), (b), (c)):
# some stuff
Every argument of nrange is a tuple of arguments which then gets passed with the * operator to range. So nrange((a1, a2, a3), (b1, b2, b3))
should also be possible.
My question, does this exist, and if not, why?
Thank you in advance. :)