[Python-ideas] Re: division of integers should result in fractions not floats

2021-05-15 Thread Martin Teichmann
Hi Chris, Hi List, having slept over it, I think I have to take back my offer to write a PEP. Why? Well, I am actually sure that it will get rejected anyways. What I would like to have is that you can write 1/2 * m * v**2, and that can be treated symbolically. Writing 1/2F instead looks ugly to

[Python-ideas] Re: division of integers should result in fractions not floats

2021-05-15 Thread Chris Angelico
On Sat, May 15, 2021 at 5:15 PM Martin Teichmann wrote: > > Hi Chris, Hi List, > > having slept over it, I think I have to take back my offer to write a PEP. > Why? Well, I am actually sure that it will get rejected anyways. Wouldn't be the first time a PEP has been written with full expectation

[Python-ideas] Re: division of integers should result in fractions not floats

2021-05-15 Thread Steven D'Aprano
On Sat, May 15, 2021 at 05:28:39PM +1000, Chris Angelico wrote: > Wouldn't be the first time a PEP has been written with full > expectation of it being rejected, though! Nor the first time that someone wrote a PEP initionally expecting it to be rejected, and had it accepted. *cough* dict union

[Python-ideas] Re: division of integers should result in fractions not floats

2021-05-15 Thread Chris Angelico
On Sat, May 15, 2021 at 6:24 PM Steven D'Aprano wrote: > > On Sat, May 15, 2021 at 05:28:39PM +1000, Chris Angelico wrote: > > > Wouldn't be the first time a PEP has been written with full > > expectation of it being rejected, though! > > Nor the first time that someone wrote a PEP initionally exp

[Python-ideas] Re: division of integers should result in fractions not floats

2021-05-15 Thread Steven D'Aprano
On Sat, May 15, 2021 at 07:14:47AM -, Martin Teichmann wrote: > In general, doing symbolic math in Python is not very beautiful. [...] > It could be fruitful to add syntax for symbolic math, but this is a > whole new topic. Looking around there also seems to be not much out > there, even ded

[Python-ideas] Re: division of integers should result in fractions not floats

2021-05-15 Thread André Roberge
On Sat, May 15, 2021 at 4:18 AM Martin Teichmann wrote: > Hi Chris, Hi List, > > having slept over it, I think I have to take back my offer to write a PEP. > Why? Well, I am actually sure that it will get rejected anyways. > > [SNIP] > > I see that you would like to sum up the discussion in a PEP

[Python-ideas] Re: division of integers should result in fractions not floats

2021-05-15 Thread Jonathan Fine
Martin wrote: In general, doing symbolic math in Python is not very beautiful. I think this is a problem worth investigating. (Disclaimer: I do research in pure mathematics.) > The number of hoops you have to jump through is large, mostly because > syntax is abused for things it was not actual

[Python-ideas] Re: division of integers should result in fractions not floats

2021-05-15 Thread Oscar Benjamin
On Sat, 15 May 2021 at 09:55, Steven D'Aprano wrote: > > On Sat, May 15, 2021 at 07:14:47AM -, Martin Teichmann wrote: > > > In general, doing symbolic math in Python is not very beautiful. > [...] > > It could be fruitful to add syntax for symbolic math, but this is a > > whole new topic. Loo

[Python-ideas] Re: division of integers should result in fractions not floats

2021-05-15 Thread Steven D'Aprano
On Fri, May 14, 2021 at 09:39:33PM +0100, Oscar Benjamin wrote: > Yes, but having a faster fraction type would be great. SymPy doesn't > actually use the fractions module because it's too slow. Instead SymPy > has its own pure Python implementation that is a little faster and > will use gmpy2's mp

[Python-ideas] Re: division of integers should result in fractions not floats

2021-05-15 Thread Oscar Benjamin
On Sat, 15 May 2021 at 12:52, Steven D'Aprano wrote: > > On Fri, May 14, 2021 at 09:39:33PM +0100, Oscar Benjamin wrote: > > > Yes, but having a faster fraction type would be great. SymPy doesn't > > actually use the fractions module because it's too slow. Instead SymPy > > has its own pure Python

[Python-ideas] Re: division of integers should result in fractions not floats

2021-05-15 Thread Oscar Benjamin
On Sat, 15 May 2021 at 05:54, Steven D'Aprano wrote: > > On Sat, May 15, 2021 at 01:57:29AM +1000, Chris Angelico wrote: > > > Decimal literals have a number of awkward wrinkles, so I'd leave them > > aside for now; > > I'm surprised at this. > > Decimal literals have come up at least twice in the

[Python-ideas] Re: division of integers should result in fractions not floats

2021-05-15 Thread David Mertz
On Sat, May 15, 2021, 3:13 PM Oscar Benjamin > That would mean that a simple statement like x = -1.01d could assign > different values depending on the context. Maybe with the new parser it is > easier to change this so that an unary +/- can be part of the literal. Steven, at least, stated he as

[Python-ideas] Re: division of integers should result in fractions not floats

2021-05-15 Thread Oscar Benjamin
On Sat, 15 May 2021 at 20:52, David Mertz wrote: > > On Sat, May 15, 2021, 3:13 PM Oscar Benjamin >> >> That would mean that a simple statement like x = -1.01d could assign >> different values depending on the context. Maybe with the new parser it is >> easier to change this so that an unary +/-