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

2021-05-17 Thread Shreyan Avigyan
Christopher Baker: > Python assumes, and converts to, floats all over the place. So users need > to understand and accommodate the limitations of floats anyway. Having > exact fractions in seemingly arbitrary places will not result in more > accurate (or precise) results in most cases, but would r

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

2021-05-17 Thread Christopher Barker
I actually think the biggest argument against this idea is exactly the same as why it’s not a major breaking change: Python assumes, and converts to, floats all over the place. So users need to understand and accommodate the limitations of floats anyway. Having exact fractions in seemingly arbitr

[Python-ideas] Re: Python 3.10: ranges in pattern matching

2021-05-17 Thread Shreyan Avigyan
Range here means low <= value <= high. I also don't understand what Valentine suggested and meant by range. I thought Valentine means low..=high as low <= value <= high and meant to say that functionality already exists. I'm really sorry for confusing everyone. __

[Python-ideas] Re: Python 3.10: ranges in pattern matching

2021-05-17 Thread Steven D'Aprano
On Mon, May 17, 2021 at 08:31:17AM -, Shreyan Avigyan wrote: > Range here means that a range or a list. Of What? A list between two > numbers, characters, etc. Python interprets numbers, characters as a > kind of PyObject. Yes it makes sense to have ranges of int and str but > not for other

[Python-ideas] Re: Python 3.10: ranges in pattern matching

2021-05-17 Thread Shreyan Avigyan
Chris: > What do you mean by "an object in range"? Please be very specific >here. I gave two interpretations, both of which make plausible sense > within Python, and it's not clear which one you're addressing, or if > you're talking about something completely different. > > What exactly is "range c

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

2021-05-17 Thread Shreyan Avigyan
Chris: > But none of the rest of your statement is an argument against Fraction > literals. If we have fractions.Fraction then we must have decimal.Decimal. We always don't judge by accuracy. There are other factors in motion that are to be considered. __

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

2021-05-17 Thread Chris Angelico
On Mon, May 17, 2021 at 5:39 PM Shreyan Avigyan wrote: > > I'm -1 on this change. Don't get me wrong I'd love having this change in > Python. *But* we use float not decimal.Decimal right? Why not? Because of > memory and precisions. That argument only takes you so far. For instance, Python uses

[Python-ideas] Re: Python 3.10: ranges in pattern matching

2021-05-17 Thread Chris Angelico
On Mon, May 17, 2021 at 5:46 PM Shreyan Avigyan wrote: > > Chris: > > There are two obvious definitions of a range: a range object, and a > > pair of inequalities. I'm not sure whether a range object is > > supported, but it's possible to use a built-in type with a guard as a > > range check: > >

[Python-ideas] Re: Python 3.10: ranges in pattern matching

2021-05-17 Thread Shreyan Avigyan
Chris: > There are two obvious definitions of a range: a range object, and a > pair of inequalities. I'm not sure whether a range object is > supported, but it's possible to use a built-in type with a guard as a > range check: By range I mean an object in range. Is it possible to match object in r

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

2021-05-17 Thread Shreyan Avigyan
I'm -1 on this change. Don't get me wrong I'd love having this change in Python. *But* we use float not decimal.Decimal right? Why not? Because of memory and precisions. Decimal takes more memory than float and also 0.33 (float) is accurate and very easy to deal with rather than 0.3