Re: [Python-ideas] Settable defaulting to decimal instead of float

2017-01-12 Thread Stephen J. Turnbull
Chris Barker - NOAA Federal writes: > However: (thank you Chris and Stephen) -- I think you mean "Stephan". :-) ___ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct:

Re: [Python-ideas] Settable defaulting to decimal instead of float

2017-01-12 Thread Chris Barker - NOAA Federal
While I think some variation of: from __optional__ import decimal_literal Might be reasonable, I'd probably rather see something like: X = 1.1D However: (thank you Chris and Stephen) -- Decimal is NOT a panacea, nor any more "accurate" than binary floating point. It is still floating point,

Re: [Python-ideas] Settable defaulting to decimal instead of float

2017-01-12 Thread Paul Moore
On 12 January 2017 at 15:34, Victor Stinner wrote: > 2017-01-12 13:13 GMT+01:00 Stephan Houben : >> Something like: >> from __syntax__ import decimal_literal > > IMHO you can already implement that with a third party library, see for > example: >

Re: [Python-ideas] Settable defaulting to decimal instead of float

2017-01-12 Thread Terry Reedy
On 1/12/2017 8:09 AM, George Fischhof wrote: And if it is mentioned, I would like to ask why binary floating point is "better". It is faster, I agree, but why "better"? Binary numbers are more evenly spread out. Consider successive two diget numbers .99, 1.0, 1.1. The difference betweem

Re: [Python-ideas] Settable defaulting to decimal instead of float

2017-01-12 Thread Chris Angelico
On Fri, Jan 13, 2017 at 12:09 AM, George Fischhof wrote: > from __future__ import use_decimal_instead_of_float > or any other import would be very good. > The most important thing in my point of view is that I do not want to > convert every variable every time to decimal. >

Re: [Python-ideas] Settable defaulting to decimal instead of float

2017-01-12 Thread Chris Angelico
On Thu, Jan 12, 2017 at 11:50 PM, Stephan Houben wrote: > 2017-01-12 13:17 GMT+01:00 Chris Angelico : >> >> Most of the time one of my students talks to me about decimal vs >> binary, they're thinking that a decimal literal (or converting the >> default

Re: [Python-ideas] Settable defaulting to decimal instead of float

2017-01-12 Thread George Fischhof
2017-01-12 13:13 GMT+01:00 Stephan Houben : > Something like: > > from __syntax__ import decimal_literal > > which would feed the rest of the file through the "decimal_literal" > transpiler. > (and not influence anything in other files). > > Not sure if you would want to

Re: [Python-ideas] Settable defaulting to decimal instead of float

2017-01-12 Thread Stephan Houben
Hi Chris, 2017-01-12 13:17 GMT+01:00 Chris Angelico : > > Most of the time one of my students talks to me about decimal vs > binary, they're thinking that a decimal literal (or converting the > default non-integer literal to be decimal) is a panacea to the "0.1 + > 0.2 != 0.3"

Re: [Python-ideas] Settable defaulting to decimal instead of float

2017-01-12 Thread Chris Angelico
On Thu, Jan 12, 2017 at 11:07 PM, Nick Coghlan wrote: > As far as I know the main barrier to that approach is simply the lack > of folks with the time, interest, and expertise needed to implement, > review, and document it, rather than it being an objectionable > proposal at

Re: [Python-ideas] Settable defaulting to decimal instead of float

2017-01-12 Thread Nick Coghlan
On 12 January 2017 at 20:30, Paul Moore wrote: > It's unlikely that there's a practical suggestion here that hasn't > been discussed before and rejected There's one practical decimal-literal-related suggestion which hasn't been rejected yet: adding a true decimal literal

Re: [Python-ideas] Settable defaulting to decimal instead of float

2017-01-12 Thread אלעזר
I think such proposals are special cases of a general theme: a compiler pragma, similar to "from __future__", to make Python support domain-specific syntax in the current file. Whether it's decimal literals or matrix/vector literals etc. I think it will be nice to make some tool, external to

Re: [Python-ideas] Settable defaulting to decimal instead of float

2017-01-12 Thread Paul Moore
On 12 January 2017 at 10:28, Victor Stinner wrote: > George requested this feature on the bug tracker: > http://bugs.python.org/issue29223 > > George was asked to start a discusson on this list. I posted the > following comment before closing the issue: > > You are not

Re: [Python-ideas] Settable defaulting to decimal instead of float

2017-01-12 Thread M.-A. Lemburg
On 12.01.2017 10:04, George Fischhof wrote: > Hi There, > > Settable defaulting to decimal instead of float > > It would be good to be able to use decimal automatically instead of float > if there is a setting. For example an environment variable or a flag file. > > Where and when accuracy is

Re: [Python-ideas] Settable defaulting to decimal instead of float

2017-01-12 Thread Victor Stinner
George requested this feature on the bug tracker: http://bugs.python.org/issue29223 George was asked to start a discusson on this list. I posted the following comment before closing the issue: You are not the first one to propose the idea. 2012: "make decimal the default non-integer instead of

[Python-ideas] Settable defaulting to decimal instead of float

2017-01-12 Thread George Fischhof
Hi There, Settable defaulting to decimal instead of float It would be good to be able to use decimal automatically instead of float if there is a setting. For example an environment variable or a flag file. Where and when accuracy is more important than speed, the user could set this flag, and