[issue31803] time.clock() should emit a DeprecationWarning

2017-12-18 Thread STINNER Victor
STINNER Victor added the comment: I read again the whole issue and I dislike the "time.clock becomes an alias to time.perf_counter" idea. Calling time.clock() now emits a deprecation warning, the issue is fixed, so I close it. Many discussions were about removal of the function. IHMO it's out

[issue31803] time.clock() should emit a DeprecationWarning

2017-10-26 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: On 26.10.2017 13:46, Serhiy Storchaka wrote: > > It is very bad, that the function with such attractive name has different > meaning on Windows and Unix. I'm sure that virtually all uses of clock() are > broken because its behavior on other platform than

[issue31803] time.clock() should emit a DeprecationWarning

2017-10-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It is very bad, that the function with such attractive name has different meaning on Windows and Unix. I'm sure that virtually all uses of clock() are broken because its behavior on other platform than used by the author of the code. Adding a DeprecationWar

[issue31803] time.clock() should emit a DeprecationWarning

2017-10-26 Thread STINNER Victor
STINNER Victor added the comment: Alexander Belopolsky: "I was not aware of time.clock() depreciation before Victor brought this issue to my attention." That's why the function now emits a DeprecationWarning :-) Alexander Belopolsky: "time.clock() is a very well-known API eponymous to a ven

[issue31803] time.clock() should emit a DeprecationWarning

2017-10-25 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: I would like to add my voice to MAL's objections. I was not aware of time.clock() depreciation before Victor brought this issue to my attention. time.clock() is a very well-known API eponymous to a venerable UNIX system call. Its limitations and plat

[issue31803] time.clock() should emit a DeprecationWarning

2017-10-25 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This is the current behavior. Do you suggest to undeprecate time.clock() after 4 releases of deprecation? -- ___ Python tracker ___ ___

[issue31803] time.clock() should emit a DeprecationWarning

2017-10-25 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: On 25.10.2017 01:31, STINNER Victor wrote: > > Marc-Andre: "Yes, to avoid yet another Python 2/3 difference. It should be > replaced with the appropriate variant on Windows and non-Windows platforms. > From Serhiy's response that's time.process_time() on

[issue31803] time.clock() should emit a DeprecationWarning

2017-10-24 Thread STINNER Victor
STINNER Victor added the comment: Marc-Andre: "Yes, to avoid yet another Python 2/3 difference. It should be replaced with the appropriate variant on Windows and non-Windows platforms. From Serhiy's response that's time.process_time() on non-Windows platforms and time.perf_counter() on Window

[issue31803] time.clock() should emit a DeprecationWarning

2017-10-24 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: On 24.10.2017 11:23, STINNER Victor wrote: > > Marc-Andre Lemburg: "Thanks for pointing that out. I didn't know." > > Do you still think that we need to modify time.clock() rather than > deprecating it? Yes, to avoid yet another Python 2/3 difference. It

[issue31803] time.clock() should emit a DeprecationWarning

2017-10-24 Thread STINNER Victor
STINNER Victor added the comment: Marc-Andre Lemburg: "Thanks for pointing that out. I didn't know." Do you still think that we need to modify time.clock() rather than deprecating it? -- ___ Python tracker

[issue31803] time.clock() should emit a DeprecationWarning

2017-10-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Yes, it is time.process_time(). This was the cause of adding two new functions time.perf_counter() and time.process_time() and deprecating (in the documentation only) time.clock(). On Windows time.clock() does include time elapsed during sleep, on non-Windo

[issue31803] time.clock() should emit a DeprecationWarning

2017-10-22 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: On 22.10.2017 15:14, Serhiy Storchaka wrote: > > Serhiy Storchaka added the comment: > > On non-Windows platforms clock() returns the processor time, perf_counter() > does include time elapsed during sleep. > import time start = time.clock();

[issue31803] time.clock() should emit a DeprecationWarning

2017-10-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: On non-Windows platforms clock() returns the processor time, perf_counter() does include time elapsed during sleep. >>> import time >>> start = time.clock(); time.sleep(1); print(time.clock() - start) 9.7001374e-05 >>> start = time.perf_counter(); ti

[issue31803] time.clock() should emit a DeprecationWarning

2017-10-22 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: On 20.10.2017 19:46, Serhiy Storchaka wrote: > > This will break a code that depends on the current behavior on non-Windows > platforms. And this will contradict the expectation of non-Windows > programmers. If change the behavior of clock() on non-Window

[issue31803] time.clock() should emit a DeprecationWarning

2017-10-20 Thread Ethan Furman
Ethan Furman added the comment: We definitely need time with either DeprecationWarning or FutureWarning before removing/substituting a function. -- ___ Python tracker ___

[issue31803] time.clock() should emit a DeprecationWarning

2017-10-20 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This will break a code that depends on the current behavior on non-Windows platforms. And this will contradict the expectation of non-Windows programmers. If change the behavior of clock() on non-Windows platforms, it should be done only after the period of

[issue31803] time.clock() should emit a DeprecationWarning

2017-10-20 Thread STINNER Victor
STINNER Victor added the comment: I wrote the PR 4062 which removes time.clock() implementation: time.clock becomes an alias to time.perf_counter. haypo@selma$ ./python Python 3.7.0a2+ (heads/clock-dirty:16b6a3033e, Oct 20 2017, 18:55:58) >>> import time >>> time.clock is time.perf_counter Tr

[issue31803] time.clock() should emit a DeprecationWarning

2017-10-20 Thread STINNER Victor
Change by STINNER Victor : -- pull_requests: +4032 stage: resolved -> patch review ___ Python tracker ___ ___ Python-bugs-list mailin

[issue31803] time.clock() should emit a DeprecationWarning

2017-10-18 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: On 18.10.2017 11:45, STINNER Victor wrote: > Marc-Andre, Ethan: What do you think of removing the deprecation warning from > the C (my last commit), leave the deprecation warning in the documentation, > and modify time.clock() to become an alias to time.pe

[issue31803] time.clock() should emit a DeprecationWarning

2017-10-18 Thread STINNER Victor
STINNER Victor added the comment: "Initially the time module was a thin wrapper around C and OS time-related functions. It may be confusing that the behavior of time.clock() differs from the behavior of C's clock()." Well, there is the theory, and there is the practice. Someone decided to im

[issue31803] time.clock() should emit a DeprecationWarning

2017-10-18 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Initially the time module was a thin wrapper around C and OS time-related functions. It may be confusing that the behavior of time.clock() differs from the behavior of C's clock(). The documentation for clock() on MSDN suggests to use GetProcessTimes() for

[issue31803] time.clock() should emit a DeprecationWarning

2017-10-18 Thread STINNER Victor
STINNER Victor added the comment: (I reopen the issue since the discussion is not over.) Marc-Andre Lemburg: "time.cock() is used in a lot of code." I ran a quick search on GitHub. I found different use cases of time.clock(): 1) Measure performance. On Windows, time.clock() has a very good pr

[issue31803] time.clock() should emit a DeprecationWarning

2017-10-18 Thread STINNER Victor
STINNER Victor added the comment: Marc Andre Lemburg: "time.cock() is used in a lot of code. Why can't we simply replace the functionality with one of the other functions ? The documentation certainly allows for such a change, since it pretty much just says that only the delta between two val

[issue31803] time.clock() should emit a DeprecationWarning

2017-10-17 Thread Ethan Furman
Ethan Furman added the comment: I agree with MAL; removing functions just makes multi-version code more painful. At least have the DeprecationWarning active for two releases before removing it. -- nosy: +ethan.furman ___ Python tracker

[issue31803] time.clock() should emit a DeprecationWarning

2017-10-17 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: time.cock() is used in a lot of code. Why can't we simply replace the functionality with one of the other functions ? The documentation certainly allows for such a change, since it pretty much just says that only the delta between two values has a meaning

[issue31803] time.clock() should emit a DeprecationWarning

2017-10-17 Thread STINNER Victor
STINNER Victor added the comment: Ok, I modified time.clock() and time.get_clock_info('clock') to emit a DeprecationWarning. Let's wait for Python 3.8 to remove time.clock() ;-) Thanks for the reviews Serhiy Storchaka and Diana Clarke! -- resolution: -> fixed stage: patch review ->