The peak-to-peak function, ptp(), is a simple and handy function to use, but it confuses the PEP20 suggestions a bit. See this discussion for reference: http://d.pr/i/snXG Based on the discussion, it may be a good idea to make the name more relevant? Some suggestions include span() or valuerange(). Among few others who have discussed this on Github (https://github.com/numpy/numpy/issues/3292#issuecomment-17353454) valuerange() appears to the best most favored one. -Eli
10.05.2013 08:47, Eli Bressert kirjoitti: [clip: renaming ptp]
valuerange() appears to the best most favored one.
range(), arange(), valuerange() I'm not really a big fan of changing the name of this function at this stage, as it seems to me that whether it's a gain or not is somewhat a matter of taste. -- Pauli Virtanen
That's a good point regarding the range function names. But, I think the issue still stands on the readability of the ptp function. Regarding PEP20 it's stated that "readability counts." If you regard what ptp is supposed to replace, array.max() - array.min(), the aforementioned follows the PEP20 better as it is more readable. If valuerange() is not an acceptable name, maybe span()? -Eli On Fri, May 10, 2013 at 10:44 PM, Pauli Virtanen <pav@iki.fi> wrote:
10.05.2013 08:47, Eli Bressert kirjoitti: [clip: renaming ptp]
valuerange() appears to the best most favored one.
range(), arange(), valuerange()
I'm not really a big fan of changing the name of this function at this stage, as it seems to me that whether it's a gain or not is somewhat a matter of taste.
-- Pauli Virtanen
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
10.05.2013 16:04, Eli Bressert kirjoitti:
That's a good point regarding the range function names. But, I think the issue still stands on the readability of the ptp function. Regarding PEP20 it's stated that "readability counts."
I think here it has to be kept in mind that this function has been called ptp() already in Numeric, i.e., for the last 10+ years. This is the first proposal to change it that I know of, so I think keeping the API the same weighs against changing it due to aesthetic reasons. -- Pauli Virtanen
On Fri, May 10, 2013 at 2:04 PM, Eli Bressert <ebressert@gmail.com> wrote:
That's a good point regarding the range function names. But, I think the issue still stands on the readability of the ptp function. Regarding PEP20 it's stated that "readability counts."
If you regard what ptp is supposed to replace, array.max() - array.min(), the aforementioned follows the PEP20 better as it is more readable. If valuerange() is not an acceptable name, maybe span()?
Sure, it's probably more readable, and that would be the controlling factor if this were a new function. But that's not really the operative question here. Are the gains in readability worth the nontrivial costs of deprecating and removing the old name? I, for one, am generally not in favor of such deprecations. -- Robert Kern
On Fri, May 10, 2013 at 3:17 PM, Robert Kern <robert.kern@gmail.com> wrote:
On Fri, May 10, 2013 at 2:04 PM, Eli Bressert <ebressert@gmail.com> wrote:
That's a good point regarding the range function names. But, I think the issue still stands on the readability of the ptp function. Regarding PEP20 it's stated that "readability counts."
If you regard what ptp is supposed to replace, array.max() - array.min(), the aforementioned follows the PEP20 better as it is more readable. If valuerange() is not an acceptable name, maybe span()?
Sure, it's probably more readable, and that would be the controlling factor if this were a new function. But that's not really the operative question here. Are the gains in readability worth the nontrivial costs of deprecating and removing the old name? I, for one, am generally not in favor of such deprecations.
That's not the only option though. I'm -1 on deprecation, but +0 on renaming and keeping ptp as an alias. The function name is really quite poor. Ralf
On Fri, May 10, 2013 at 2:27 PM, Ralf Gommers <ralf.gommers@gmail.com> wrote:
On Fri, May 10, 2013 at 3:17 PM, Robert Kern <robert.kern@gmail.com> wrote:
On Fri, May 10, 2013 at 2:04 PM, Eli Bressert <ebressert@gmail.com> wrote:
That's a good point regarding the range function names. But, I think the issue still stands on the readability of the ptp function. Regarding PEP20 it's stated that "readability counts."
If you regard what ptp is supposed to replace, array.max() - array.min(), the aforementioned follows the PEP20 better as it is more readable. If valuerange() is not an acceptable name, maybe span()?
Sure, it's probably more readable, and that would be the controlling factor if this were a new function. But that's not really the operative question here. Are the gains in readability worth the nontrivial costs of deprecating and removing the old name? I, for one, am generally not in favor of such deprecations.
That's not the only option though. I'm -1 on deprecation, but +0 on renaming and keeping ptp as an alias. The function name is really quite poor.
I think it is a matter of context. I don't know the history of that function, but coming from a signal processing background, its meaning was obvious to me. It is a peak to peak is a very common operations when dealing with audio file, for example (that's how most wave display work AFAIK). I am certainly -1 on the deprecation as well, and -0 on alias. David
On May 10, 2013 3:18 PM, "Robert Kern" <robert.kern@gmail.com> wrote:
Sure, it's probably more readable
I am not sure of it. I would have to check the docs to see what it means. The mathematical term is range, but it already has a meaning in Python, so it is not a good way to go, being perhaps valuerange the compromise, but not really clear by itself. In some areas, nevertheless, ptp is the standard notation, as it is in electronics - and maybe that is why it made its way into Numeric.
participants (6)
-
David Cournapeau -
Daπid -
Eli Bressert -
Pauli Virtanen -
Ralf Gommers -
Robert Kern