Re: Unexpected PendingDeprecationWarning

2016-11-22 Thread Nathan Ernst
Thanks, ChrisA On Tue, Nov 22, 2016 at 9:24 PM, Chris Angelico wrote: > On Wed, Nov 23, 2016 at 2:14 PM, Nathan Ernst > wrote: > > I was not aware of that PEP. > > > > The logic in my function is exactly as desired, so to squelch the > warning, > > I merely wrapped the iteration in a try/except

Re: Unexpected PendingDeprecationWarning

2016-11-22 Thread Chris Angelico
On Wed, Nov 23, 2016 at 2:14 PM, Nathan Ernst wrote: > I was not aware of that PEP. > > The logic in my function is exactly as desired, so to squelch the warning, > I merely wrapped the iteration in a try/except: > > def adjacent_difference(seq, selector=identity): > i = iter(seq) > l = select

Re: Unexpected PendingDeprecationWarning

2016-11-22 Thread Chris Angelico
On Wed, Nov 23, 2016 at 1:50 PM, Nathan Ernst wrote: > 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 = selec

Re: Unexpected PendingDeprecationWarning

2016-11-22 Thread Nathan Ernst
Thanks, I was not aware of that PEP. The logic in my function is exactly as desired, so to squelch the warning, I merely wrapped the iteration in a try/except: def adjacent_difference(seq, selector=identity): i = iter(seq) l = selector(next(i)) try: while True: r = selector(next(

Re: Unexpected PendingDeprecationWarning

2016-11-22 Thread MRAB
On 2016-11-23 02:50, Nathan Ernst wrote: 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:

Unexpected PendingDeprecationWarning

2016-11-22 Thread Nathan Ernst
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