One of the lovely things about Python is that we have the capability to avoid
issues such as the vagaries of the floating point type with libraries such as
decimal and fractions. This is wonderous to me but comes with an issue that I
suspect is limiting its usage. That issue is that you have to
On Thu, 5 Mar 2020 at 09:28, Steve Barnes wrote:
> Wouldn’t it be possible to have something along the lines of:
>
> ```
> from decimal import TreatFloatsAsDecimal
> @TreatFloatsAsDecimal
> a = 0.1 # These are all now decimals
> b = 0.2
> c = 0.3
>
> a + b == c # This now works
> ```
I'm not at
On Thu, Mar 5, 2020 at 5:29 AM Steve Barnes wrote:
> One of the lovely things about Python is that we have the capability to
> avoid issues such as the vagaries of the floating point type with libraries
> such as decimal and fractions. This is wonderous to me but comes with an
> issue that I susp
I've written my share of mathematical and physics software by now and
arbitrary-precision rational numbers are hardly ever a good solution to
problems you might be having. Paul Moore has mentioned how few keystrokes
this syntax would actually save: add to this the fact that there are
probably very
Comments in-line (I wish Outlook would behave sensibly)
-Original Message-
From: Paul Moore
Sent: 05 March 2020 09:52
To: Steve Barnes
Cc: python-ideas@python.org
Subject: Re: [Python-ideas] IDEA: Allow override of all assignments of a built
in type to be a different type
On Thu, 5 Ma
Fascinating material André.
I am sure that some people would love the idea of a fractional or decimal
iterator, (as long as they don’t try to use it as an index).
Steve
From: André Roberge
Sent: 05 March 2020 09:56
To: Steve Barnes
Cc: python-ideas@python.org
Subject: Re: [Python-ideas] IDEA:
Steve Jorgensen wrote:
> The problem I came up with trying to spike out my proposal last night is that
> there
> doesn't seem to be anyway to implement it without creating infinite recursion
> in the
> issublcass call. If I make Orderable a real or virtual subclass
> of ProtoOrderable and Ordera
On Thu, Mar 5, 2020 at 8:27 PM Steve Barnes wrote:
>
> One of the lovely things about Python is that we have the capability to avoid
> issues such as the vagaries of the floating point type with libraries such as
> decimal and fractions. This is wonderous to me but comes with an issue that I
>
-Original Message-
From: Chris Angelico
Sent: 05 March 2020 11:42
To: python-ideas@python.org
Subject: [Python-ideas] Re: IDEA: Allow override of all assignments of a built
in type to be a different type
On Thu, Mar 5, 2020 at 8:27 PM Steve Barnes wrote:
>
> One of the lovely things
On 3/5/20 1:27 AM, Greg Ewing wrote:
On 5/03/20 4:08 pm, Richard Damon wrote:
Sometimes I wonder if since Python supports dynamic typing of
results, might not do better by removing the NaN value from Floats
and Decimals, and make the operations that generate the NaN generate
an object of a spe
On 3/4/20 11:07 PM, Andrew Barnert via Python-ideas wrote:
On Mar 4, 2020, at 19:12, Richard Damon wrote:
Yes, because of the NaN issue, you sort of need an 'Almost Total Order' and
'Really Truly a Total Order', the first allowing the small exception of a very
limited (maybe only one) special
On Thu, Mar 05, 2020 at 08:23:22AM -0500, Richard Damon wrote:
> Yes, that is the idea of AlmostTotalOrder, to have algorithms that
> really require a total order (like sorting)
Sorting doesn't require a total order. Sorting only requires a weak
order where the only operator required is the "co
On Thu, Mar 05, 2020 at 12:39:38PM +, Steve Barnes wrote:
> Hmm, is there a PEP regarding Decimal literals?
No.
> I couldn't find one,
> although there is PEP 240 regarding rational literals. Maybe it's time
> to write up a rejected PEP explaining exactly what the problems are
> with Deci
On Thu, Mar 5, 2020 at 4:27 AM Steve Barnes wrote:
> One of the lovely things about Python is that we have the capability to
> avoid issues such as the vagaries of the floating point type with libraries
> such as decimal and fractions. This is wonderous to me but comes with an
> issue that I susp
On Thu, Mar 5, 2020 at 5:55 AM André Roberge
wrote:
>
>
> On Thu, Mar 5, 2020 at 5:29 AM Steve Barnes
> wrote:
>
>> One of the lovely things about Python is that we have the capability to
>> avoid issues such as the vagaries of the floating point type with libraries
>> such as decimal and fracti
On Wed, Mar 4, 2020 at 8:13 PM Andrew Barnert via Python-ideas <
python-ideas@python.org> wrote:
> Sorry, I thought I was replying to something from today, not a year ago.
Which is fine — that conversation kind of petered out anyway, and I think
reviving it is a fine idea.
It sounds like you at
On 03/04/2020 06:24 AM, Steven D'Aprano wrote:
My earlier use-case still stands: feature detection where a function has
changed its parameter list. More on this below.
It seems like `inspect.signature` is the right way to do this kind of
feature detection.
On Wed, Mar 04, 2020 at 12:19:25PM
On Thu, Mar 5, 2020 at 11:09 AM Todd wrote:
> On Thu, Mar 5, 2020 at 4:27 AM Steve Barnes
> wrote:
>
>>
>> SNIP
>
>>
>> Wouldn’t it be possible to have something along the lines of:
>>
>>
>>
>> ```
>>
>> from decimal import TreatFloatsAsDecimal
>>
>> @TreatFloatsAsDecimal
>>
>> a = 0.1 # These
I think we need to be careful here. This whole idea is predicated an
assumption that Decimals are inherently ”better” or more accurate than
binary floats.
They are not. The only real advantage is that they fit most people’s mental
model better. But that’s actually a bit dangerous, as it makes the
On Mar 5, 2020, at 05:24, Richard Damon wrote:
>
> On 3/4/20 11:07 PM, Andrew Barnert via Python-ideas wrote:
>>> On Mar 4, 2020, at 19:12, Richard Damon wrote:
>>> Yes, because of the NaN issue, you sort of need an 'Almost Total Order' and
>>> 'Really Truly a Total Order', the first allowing
On Thu, Mar 5, 2020 at 7:02 AM Steven D'Aprano wrote:
> On Thu, Mar 05, 2020 at 12:39:38PM +, Steve Barnes wrote:
>
> > Hmm, is there a PEP regarding Decimal literals?
>
> No.
>
> > I couldn't find one,
> > although there is PEP 240 regarding rational literals. Maybe it's time
> > to write up
> On Mar 5, 2020, at 01:27, Steve Barnes wrote:
> One of the lovely things about Python is that we have the capability to avoid
> issues such as the vagaries of the floating point type with libraries such as
> decimal and fractions. This is wonderous to me but comes with an issue that I
> suspe
Steve Jorgensen wrote:
> Steve Jorgensen wrote:
>
> > The problem I came up with trying to spike out my
> > proposal last night is that there
> > doesn't seem to be anyway to implement it without creating infinite
> > recursion in the
> > issublcass call. If I make Orderable a real or virtual sub
It seems to me that this thread is a bit too focused. I know I’ve found
that often I wish I knew better exactly what caused a particular Exception—
there are many that can be raised for various reasons, and you may need to
know which one in order to handle it properly.
At this point, parsing the e
On Mar 5, 2020, at 02:11, Steve Barnes wrote:
>
> Comments in-line (I wish Outlook would behave sensibly)
>
> -Original Message-
> From: Paul Moore
> Sent: 05 March 2020 09:52
> To: Steve Barnes
> Cc: python-ideas@python.org
> Subject: Re: [Python-ideas] IDEA: Allow override of all a
On Mar 5, 2020, at 11:05, Steve Jorgensen wrote:
>
> Steve Jorgensen wrote:
>> Steve Jorgensen wrote:
>>
>>> The problem I came up with trying to spike out my
>>> proposal last night is that there
>>> doesn't seem to be anyway to implement it without creating infinite
>>> recursion in the
>>>
On Mar 5, 2020, at 08:27, Christopher Barker wrote:
>
>> On Wed, Mar 4, 2020 at 8:13 PM Andrew Barnert via Python-ideas
>> wrote:
>
>> Sorry, I thought I was replying to something from today, not a year ago.
>
> Which is fine — that conversation kind of petered out anyway, and I think
> revi
On 5/03/20 11:09 pm, Steve Barnes wrote:
just about any financial calculations for example - I have seen quite
a lot of such code that works in pennies or cents and then scales the
results for example.
But how much real-world financial code uses hard-coded amounts of
money, rather than reading
[Steven D'Aprano ]
> Sorting doesn't require a total order. Sorting only requires a weak
> order where the only operator required is the "comes before" operator,
> or less than. That's precisely how sorting in Python is implemented.
Let's be careful here. Python's list.sort() guarantees that _if_
On 3/5/20 9:10 AM, Steven D'Aprano wrote:
On Thu, Mar 05, 2020 at 08:23:22AM -0500, Richard Damon wrote:
Yes, that is the idea of AlmostTotalOrder, to have algorithms that
really require a total order (like sorting)
Sorting doesn't require a total order. Sorting only requires a weak
order wher
Andrew Barnert wrote:
> On Mar 5, 2020, at 11:05, Steve Jorgensen ste...@stevej.name wrote:
> > Steve Jorgensen wrote:
> > Steve Jorgensen wrote:
> >
> > The problem I came up with trying to spike out
> > my
> > proposal last night is that there
> > doesn't seem to be anyway to implement it witho
On 3/5/20 1:37 PM, Andrew Barnert via Python-ideas wrote:
On Mar 5, 2020, at 05:24, Richard Damon wrote:
On 3/4/20 11:07 PM, Andrew Barnert via Python-ideas wrote:
On Mar 4, 2020, at 19:12, Richard Damon wrote:
Yes, because of the NaN issue, you sort of need an 'Almost Total Order' and
'Rea
Hello Andrew, thank you for your answer.
"Your reply was that you don’t have permission to modify the text." by this I
meant that the data is transferred to me as it is and I can't modify the text
in the source (because someone else is the database admin) but it is possible
for me to modify the
On Fri, Mar 6, 2020 at 6:22 PM Aleksi Matikainen
wrote:
> And in the end, I ended up transforming the strings, using str.replace as you
> and the comments in Stack Overflow suggested. It worked great!
> It is also a good point that I should explain in detail why a module should
> be changed, I w
34 matches
Mail list logo