Unexpected PendingDeprecationWarning
Nathan Ernst
nathan.ernst at gmail.com
Tue Nov 22 21:50:40 EST 2016
I'm using Python 3.5.2, and the following code (when invoked) causes a
PendingDeprecationWarning when used in a unit test:
def identity(x):
return x
def adjacent_difference(seq, selector=identity):
i = iter(seq)
l = selector(next(i))
while True:
r = selector(next(i))
yield r - l
l = r
I wrote this to mimic the C++ std algorithm (defined here:
http://en.cppreference.com/w/cpp/algorithm/adjacent_difference).
What I don't understand is why I get this warning.
The exact error message I get from unittest is:
PendingDeprecationWarning: generator 'adjacent_difference' raised
StopIteration
I'd appreciate any insight into what is causing this deprecation warning,
as I am stumped.
Regards,
Nate
More information about the Python-list
mailing list