I am trying to use the next function on an iterator, however I have a local variable in the same scope, which is also called next . The obvious solution is to rename the local variable, however I'm pretty new to Python, so I'm interested in learning how to prefix the next function so that I achieve the desired behavior.
The code I use looks something like this:
for prev, curr, next in neighborhood(list): if (prev == desired_value): print(prev+" "+next) desired_value = next(value_iterator)
Please note that I am using Python 3.2.
source share