[Python-ideas] Re: 'Infinity' constant in Python

2020-10-18 Thread Wes Turner
Thanks for your feedback Rob. On Sun, Oct 18, 2020, 12:27 AM Rob Cliffe via Python-ideas < python-ideas@python.org> wrote: > > > On 11/10/2020 22:47, Wes Turner wrote: > > Indeed, perhaps virtual particles can never divide by zero and thus the > observed laws of thermodynamic systems are preserve

[Python-ideas] Re: 'Infinity' constant in Python

2020-10-18 Thread Wes Turner
assert math.inf**0 == 1 assert math.inf**math.inf == math.inf On Sun, Oct 18, 2020, 3:13 AM Wes Turner wrote: > Thanks for your feedback Rob. > > On Sun, Oct 18, 2020, 12:27 AM Rob Cliffe via Python-ideas < > python-ideas@python.org> wrote: > >> >> >> On 11/10/2020 22:47, Wes Turner wrote: >> >>

[Python-ideas] Re: 'Infinity' constant in Python

2020-10-18 Thread Wes Turner
Its probably best to Carry on with the infinity constant discussion On Sun, Oct 18, 2020, 3:26 AM Wes Turner wrote: > assert math.inf**0 == 1 > assert math.inf**math.inf == math.inf > > On Sun, Oct 18, 2020, 3:13 AM Wes Turner wrote: > >> Thanks for your feedback Rob. >> >> On Sun, Oct 18, 2020

[Python-ideas] Re: 'Infinity' constant in Python

2020-10-18 Thread Steven D'Aprano
On Sun, Oct 18, 2020 at 03:26:11AM -0400, Wes Turner wrote: > assert math.inf**0 == 1 > assert math.inf**math.inf == math.inf Wes, I don't understand what point you are trying to make here. Are you agreeing with that behaviour? Disagreeing? Thought it was so surprising that you can't imagine wh

[Python-ideas] Re: New feature

2020-10-18 Thread Eryk Sun
On 10/17/20, Christopher Barker wrote: > > then how about os.clear_terminal() ? IMO, an os level function such as os.clear_terminal(fd) should only support terminal/console devices and would be implemented in Modules/posixmodule.c. Higher-level behavior and support for IDEs belongs in shutil. >

[Python-ideas] Re: 'Infinity' constant in Python

2020-10-18 Thread Wes Turner
Thank you for the explanation. I have nothing more to add to this discussion On Sun, Oct 18, 2020, 4:47 AM Steven D'Aprano wrote: > On Sun, Oct 18, 2020 at 03:26:11AM -0400, Wes Turner wrote: > > > assert math.inf**0 == 1 > > assert math.inf**math.inf == math.inf > > Wes, I don't understand what

[Python-ideas] Re: 'Infinity' constant in Python

2020-10-18 Thread Wes Turner
Actually, where in the docs is it clarified which parts of IEEE-754 are obeyed by Python? Or where should this be clarified? To my understanding (according to Wikipedia), IEEE-754 returns +- infinity for DivideByZeroError and for FloatOverflow. ... It's a rare use case; but one use case where th

[Python-ideas] Re: New feature

2020-10-18 Thread Mike Miller
On 2020-10-17 17:21, Eryk Sun wrote: On 10/16/20, Rob Cliffe via Python-ideas wrote: May I suggest it be called os.clearscreen()? I'd prefer shutil.clear_screen(). There's already shutil.get_terminal_size(). I know there's also os.get_terminal_size(), but its use isn't encouraged. Clear

[Python-ideas] Re: New feature

2020-10-18 Thread Mike Miller
On 2020-10-17 17:05, Eryk Sun wrote: CMD's CLS is implemented with three API calls: GetConsoleScreenBufferInfo to get the screen-buffer dimensions and default text attributes, ScrollConsoleScreenBufferW to shift the buffer out, and SetConsoleCursorPosition to move the cursor to (0,0). Would

[Python-ideas] Re: New feature

2020-10-18 Thread Eryk Sun
On 10/18/20, Mike Miller wrote: > > Also, a shell is not a terminal, so terminal routines don't feel right in > shutil. Putting get_terminal_size() there was a mistake imho. The shutil module "offers a number of high-level operations on files". ISTM that shutil.get_terminal_size is a high-level

[Python-ideas] Re: New feature

2020-10-18 Thread Eryk Sun
On 10/18/20, Mike Miller wrote: > On 2020-10-17 17:05, Eryk Sun wrote: >> CMD's CLS is implemented with three API calls: >> GetConsoleScreenBufferInfo to get the screen-buffer dimensions and >> default text attributes, ScrollConsoleScreenBufferW to shift the >> buffer out, and SetConsoleCursorPosi

[Python-ideas] Re: 'Infinity' constant in Python

2020-10-18 Thread Christopher Barker
On Sun, Oct 18, 2020 at 9:49 AM Wes Turner wrote: > Actually, where in the docs is it clarified which parts of IEEE-754 are > obeyed by Python? > Not sure, but I think the answer is "Most places" -- that is, cPython depends on teh compiler, math library, and hardware, most of which these days ar

[Python-ideas] Re: 'Infinity' constant in Python

2020-10-18 Thread Steven D'Aprano
Oops, I messed up. (Thanks David for pointing that out.) On Sun, Oct 18, 2020 at 07:45:40PM +1100, Steven D'Aprano wrote: > Each of these number systems have related, but slightly different, > rules. For example, IEEE-754 has a single signed infinity and 2**INF is > exactly equal to INF. But in