[Numpy-discussion] padding options for diff

Peter Creasey p.e.creasey.00 at googlemail.com
Wed Oct 26 16:31:18 EDT 2016

> Date: Wed, 26 Oct 2016 16:18:05 -0400
> From: Matthew Harrigan <harrigan.matthew at gmail.com>
> Would it be preferable to have to_begin='first' as an option under the
> existing kwarg to avoid overlapping?
>> if keep_left:
>>     if to_begin is None:
>>         to_begin = np.take(a, [0], axis=axis)
>>     else:
>>         raise ValueError(?np.diff(a, keep_left=False, to_begin=None)
>> can be used with either keep_left or to_begin, but not both.?)
>> Generally I try to avoid optional keyword argument overlap, but in
>> this case it is probably justified.

It works for me. I can't *think* of a case where you could have a
np.diff on a string array and 'first' could be confused with an
element, since you're not allowed diff on strings in the present numpy
anyway (unless wiser heads than me know something!). Feel free to move
the conversation to github btw.


More information about the NumPy-Discussion mailing list