Mark Dickinson added the comment:
Sorry that I've taken so long to get back to this. I've just updated the PR,
and I think it's ready to go. Looks like it does need you to update your GitHub
username here in the "Your Details" section of the bugtracker, though; sorry
about that
Mark Dickinson added the comment:
Whoops. Sorry, that should be #4153.
--
___
Python tracker
<https://bugs.python.org/issue34484>
___
___
Python-bugs-list mailin
Mark Dickinson added the comment:
For history, this text was introduced as a result of issue #4163.
--
___
Python tracker
<https://bugs.python.org/issue34
New submission from Mark Dickinson :
The Unicode HOWTO currently has contains this text in the "Files in an Unknown
Encoding" section [1]:
> The surrogateescape error handler will decode any non-ASCII bytes as code
> points in the Unicode Private Use Area ranging from
Change by Mark Dickinson :
--
nosy: +vinay.sajip
___
Python tracker
<https://bugs.python.org/issue34350>
___
___
Python-bugs-list mailing list
Unsubscribe:
Mark Dickinson added the comment:
Closing as duplicate of #34348.
--
nosy: +mark.dickinson
resolution: -> duplicate
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Mark Dickinson added the comment:
> How do I reach to the upstream scikit-learn folks ?
See http://scikit-learn.org/stable/support.html
Closing here.
--
resolution: -> third party
stage: -> resolved
status: open -> closed
___
Py
Mark Dickinson added the comment:
Have you reported this upstream to the scikit-learn folks? scikit-learn is not
part of core Python, so there's probably not a lot we can do here.
--
nosy: +mark.dickinson
___
Python tracker
<ht
Mark Dickinson added the comment:
The behaviour is long-standing and documented, in the note just under this
entry:
https://docs.python.org/3/library/logging.html?highlight=logging#logging.log
But I do agree that it's surprising and (at least for me) undesirable
behaviour, in that it makes
Mark Dickinson added the comment:
This isn't a bug: in short, you're evaluating a discontinuous function very
close to a discontinuity; the errors inherent in floating-point arithmetic put
you the "wrong" side of the discontinuity.
Or more simply, with binary floating-point, Wh
Mark Dickinson added the comment:
For the record, let me register my objection here. I'm not convinced by adding
math.dist, and am surprised that this was committed. Almost all the discussion
in this issue was about adding multi-argument hypot, which seems like an
obviously useful building
Mark Dickinson added the comment:
[Victor]
> Is it really important to accept integral float?
Possibly not, but acceptance of integral floats is deliberate, by-design,
tested behaviour, so it at least deserves a deprecation period if we're going
to get rid of it. (I'm -
Mark Dickinson added the comment:
FTR, here "fixed point" refers to the output representation (a decimal string)
rather than the input (a floating-point binary value). The output of %f gives a
*fixed* number of places after the decimal point (6 by default).
Contrast with %e, w
Mark Dickinson added the comment:
So I'm against _adding_ support for Decimal and Fraction on various grounds:
(1) If it's our intention to deprecate acceptance of non-integral types, then
it seems odd to deliberately add a new intentional feature (acceptance of
integral-valued Decimal
Mark Dickinson added the comment:
> accepting non-integral floats but not non-integral Decimals and Fractions.
I don't think anyone is proposing to accept non-integral floats. non-integral
floats are _already_ rejected with a ValueError. Did you mean "integral"
instead of
Mark Dickinson added the comment:
[Tal Einat]
> So we keep things consistent by supporting Decimal and Fraction inputs, but
> raising ValueError if the value isn't a non-negative integer?
Re-reading the issue comments, my preference is still the same as expressed in
msg
Mark Dickinson added the comment:
> 4. Performing these calculations with at least one extra sign extension bit
> in a finite two's complement representation (a working bit-width of ``1 +
> max(x.bit_length(), y.bit_length()`` or more) is sufficient to get the same
> result as i
Mark Dickinson added the comment:
The wording for change 1 looks fine to me.
For change 2, the mention of the internal representation is misleading, since
the internal representation of (long) integers in current CPython is
effectively sign-magnitude, and so there are some shenanigans
Mark Dickinson added the comment:
This was a side-effect of #29469.
--
nosy: +inada.naoki, mark.dickinson, serhiy.storchaka, vstinner
___
Python tracker
<https://bugs.python.org/issue34
Change by Mark Dickinson :
--
nosy: +belopolsky
___
Python tracker
<https://bugs.python.org/issue34023>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Mark Dickinson :
On Python 2.x on Windows, creating a timedelta with an `np.int32` instance for
the number of seconds can (somewhat) silently give wrong results.
Enthought Deployment Manager -- https://www.enthought.com
Python 2.7.13 |Enthought, Inc. (x86_64)| (default
Mark Dickinson added the comment:
This isn't a bug: I'm guessing that you expected an output of `['6', '8',
'10']`, but in the example you give you're sorting strings rather than numbers,
and those strings are sorted lexicographically (i.e., using "dictionary order")
as normal.
I
Change by Mark Dickinson :
--
nosy: +eric.smith, mark.dickinson
___
Python tracker
<https://bugs.python.org/issue33954>
___
___
Python-bugs-list mailin
Mark Dickinson added the comment:
Some relevant notes from Vincent Lefèvre here:
http://www.vinc17.net/research/extended.en.html
--
___
Python tracker
<https://bugs.python.org/issue24
Mark Dickinson added the comment:
[Tim]
> Mark, do you believe that 32-bit Linux uses a different libm?
I don't know. But I'd expect to see accuracy losses as a result of forcing
53-bit precision, and I wouldn't be totally surprised to see other more
catastrophic failure modes (infin
Mark Dickinson added the comment:
[Tim]
> a couple lines of inline assembler could be added at Python startup to
> set the Pentium's FPU "precision control" bits to "round to 53 bits" mode
On second thoughts, I don't think this will work; or at least, not easily. Th
Mark Dickinson added the comment:
> Python _configuration_ should be changed to disable double rounding on such
> platforms
That sounds good to me, with the nitpick that setting an x87 FPU to 53-bit
precision still doesn't avoid potential double rounding on underflow, and I'm
not
Mark Dickinson added the comment:
Thanks, Francois. Indeed, comparing hashes isn't a good way to implement
equality. :-) Closing here.
--
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/i
Change by Mark Dickinson :
--
resolution: -> not a bug
status: open -> pending
___
Python tracker
<https://bugs.python.org/issue33784>
___
___
Python-bugs-
Change by Mark Dickinson :
--
nosy: +serhiy.storchaka
___
Python tracker
<https://bugs.python.org/issue33784>
___
___
Python-bugs-list mailing list
Unsubscribe:
Mark Dickinson added the comment:
> I'd propose hashing a tuple instead of using the xor.
To be clear; I'd propose this _only_ if there's evidence that the current
hashing scheme is unsatisfactory for real-world use-cases. Otherwise, on an "if
it's not broken, don't fix it" b
Mark Dickinson added the comment:
This shouldn't be a problem: there's no rule that says that different objects
should have different hashes. Indeed, with a countable infinity of possible
different hashable inputs, a deterministic hashing algorithm, and only finitely
many outputs
Mark Dickinson added the comment:
This doesn't look like a valid base64 string to me: the padding (if present) at
the end of the string should be either "=" or "==", never "===".
Is the length of the decoded string equal to 58? If so, what's the last
ch
Mark Dickinson <dicki...@gmail.com> added the comment:
@nanthil: If you want to discuss the reasons behind this design decision
further, I'd suggest asking on one of the mailing lists, e.g.
https://mail.python.org/mailman/listinfo/python-list
This is not the right forum for this disc
Change by Mark Dickinson <dicki...@gmail.com>:
--
stage: -> resolved
status: pending -> closed
___
Python tracker <rep...@bugs.python.org>
<https://bugs.
Mark Dickinson <dicki...@gmail.com> added the comment:
It's documented here:
https://docs.python.org/3/library/stdtypes.html#mapping-types-dict
> Numeric types used for keys obey the normal rules for numeric
> comparison: if two numbers compare equal (such as 1 and 1.0) then
Mark Dickinson <dicki...@gmail.com> added the comment:
The point is that if you cache the total and update on each operation, you end
up with a total that depends not just on the current contents of the Counter,
but also on the history of operations. That seems like a bad idea: you could
Mark Dickinson <dicki...@gmail.com> added the comment:
> total should be a cached property, that's updated on every Counter update
That would run into difficulties for Counters with float values: e.g., after
>>> c = Counter()
>>> c['spam'] = 1e100
>>
Change by Mark Dickinson <dicki...@gmail.com>:
--
nosy: +mark.dickinson
___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue15443>
___
Mark Dickinson <dicki...@gmail.com> added the comment:
Marking as pending; we can't take this forward without more input from the OP.
As far as I can tell, the documentation is perfectly correct here: I suspect
that there was a misunderstanding somewhere along the line.
--
as
Mark Dickinson <dicki...@gmail.com> added the comment:
I can't reproduce. I'm looking at
https://docs.python.org/3.6/tutorial/introduction.html#strings, and when I test
things in Python 3.6.5, I see exactly the same output as given in the
documentation:
Python 3.6.5 (default, Mar 29 20
Mark Dickinson <dicki...@gmail.com> added the comment:
-1 from me. Apart from anything else, the output for a general fraction looks
(to my eyes) ugly in a fixed-width font: the tiny digits are harder to read,
and there's too much space between successive numerator (or denominator)
Mark Dickinson <dicki...@gmail.com> added the comment:
Gah! Forgot that my post would reset this issue to open. I'm going to close
here, since this would be a sufficiently big and unlikely change that it's not
going to happen without a python-ideas/python-dev discussion.
--
reso
Mark Dickinson <dicki...@gmail.com> added the comment:
[Steven]
> please take the idea to the numpy and/or Python-Ideas mailing lists for
> further discussion:
But please do read through the previous discussions before starting a new one!
See the links in PEP 465, and particu
Mark Dickinson <dicki...@gmail.com> added the comment:
"""Return a random integer x satisfying 0 <= x < n""" ?
--
nosy: +mark.dickinson
___
Python tracker <rep...@bugs.py
Mark Dickinson <dicki...@gmail.com> added the comment:
For the message:
> invalid token, use 0o prefix for octal integers
I'd expect (without having any evidence to back this up) that the majority of
people who encounter this error would be those who intended a decimal literal
ra
Mark Dickinson <dicki...@gmail.com> added the comment:
Maybe once Python 2.7 officially reaches EOL, we can remove the syntax error
altogether and allow leading zeros on decimal integer literals.
--
nosy: +mark.dickinson
___
Python tracke
Mark Dickinson <dicki...@gmail.com> added the comment:
Does anyone seriously write "{*()}" instead of "set()"?
--
nosy: +mark.dickinson
___
Python tracker <rep...@bugs.python.org>
<
Change by Mark Dickinson <dicki...@gmail.com>:
--
nosy: +mark.dickinson
___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue24234>
___
Mark Dickinson <dicki...@gmail.com> added the comment:
Given that Misc/cheatsheet doesn't exist any more in the Python 3 repo, and
Python 2 is nearing end-of-life, I suspect this should just be closed.
--
stage: needs patch -> resolved
status: pending
Mark Dickinson <dicki...@gmail.com> added the comment:
> Mark, I tried `Fraction(10**23) // 1e22`, and I got 10.
Sorry: that result was with your PR (as it was at the time I wrote that
comment). On master, you do indeed get 10.
> I think the fact that floating-point rounding err
Mark Dickinson <dicki...@gmail.com> added the comment:
Okay, that cut and paste didn't work so well. Just imagine an infinity symbol
in those missing spaces. Trying again:
> For the hypot function, hypot(±0, ±0) is +0, hypot(±∞, qNaN) is +∞, and
>
Mark Dickinson <dicki...@gmail.com> added the comment:
> By the same logic, if there's an infinite argument to hypot(), it doesn't
> matter what any other argument is - the result is +inf regardless.
Yep, that's what IEEE 754-2008 says for the two-argument case, so I think
that
Mark Dickinson <dicki...@gmail.com> added the comment:
Raymond: what are your thoughts on deprecating the ability of `math.factorial`
to accept a float (as in `math.factorial(5.0)` -> `120`)?
For me, I'm not sure I see the value of the deprecation. It's the usual story:
the answer to
Mark Dickinson <dicki...@gmail.com> added the comment:
+1 for a single-rounded dot product. If we're allowed to assume IEEE 754, it's
straightforward to code up something that's not too inefficient and gives
correctly rounded results for "normal" cases, using a combina
Mark Dickinson <dicki...@gmail.com> added the comment:
> then the answer being 90 is correct,right?
How do you deduce that? Why 90 rather than 85 (or 87.5, or some other value)?
For what it's worth, NumPy gives a result of NaN for the median of an array
that contains NaNs:
>>&
Mark Dickinson <dicki...@gmail.com> added the comment:
> Will just removing all np.nan values do the job?
Unfortunately, I don't think it's that simple. You want consistency across the
various library calls, so if the various `median` functions are changed to
treat NaNs as mis
Mark Dickinson <dicki...@gmail.com> added the comment:
I'd suggest that in the not-float branch of math_factorial, we use
PyNumber_Index to catch integer-like things. (That would also be consistent
with what we do in math_gcd.)
--
___
Mark Dickinson <dicki...@gmail.com> added the comment:
I opened #33083, and copied the nosy list from this issue across.
--
___
Python tracker <rep...@bugs.python.org>
<https://bugs.python
New submission from Mark Dickinson <dicki...@gmail.com>:
Observed by Terry Reedy in the issue #25735 discussion (msg255479):
>>> factorial(decimal.Decimal(5.2))
120
This should be either raising an exception (either ValueError or TypeError,
depending on whether we want to accep
Mark Dickinson <dicki...@gmail.com> added the comment:
> Should the documentation patch for this be converted to a PR
I think so, yes. How about we open a new issue for the factorial(Decimal(...))
behaviour, and keep this one focused on the original repor
Mark Dickinson <dicki...@gmail.com> added the comment:
[Tim]
> [...] what would _you_ like to see done here?
Given that float.as_integer_ratio and Decimal.as_integer_ratio already exist,
and that I don't have a working time machine right now, I'm in favour of adding
int.as_inte
Mark Dickinson <dicki...@gmail.com> added the comment:
It's a "virtual" subclass. The numpy.integer parent class is registered here:
https://github.com/numpy/numpy/blob/10ccfe747a68d974ff16a5c0765054b816d5486f/numpy/core/nume
Mark Dickinson <dicki...@gmail.com> added the comment:
Yes, that sort of thing is going to happen as soon as floating-point enters the
mix. There will be surprises from Fraction % float as well as float % Fraction:
>>> from fractions import Fraction
>>> Fraction(10**23)
Mark Dickinson <dicki...@gmail.com> added the comment:
Thanks for the PR (and apologies for being slow to look at it). I think we want
to use the operator_fallbacks approach for both __rfloordiv__ and __floordiv__
(and similarly for __rmod__ and __mod__), else we'll get inconsistent r
Mark Dickinson <dicki...@gmail.com> added the comment:
On the Fraction constructor, it looks like there's some overlap with the goals
of issue #28716 here.
--
___
Python tracker <rep...@bugs.python.org>
<https://bugs.python
Change by Mark Dickinson <dicki...@gmail.com>:
--
nosy: +mark.dickinson
___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33073>
___
Mark Dickinson <dicki...@gmail.com> added the comment:
Apologies: the title change was accidental. Reverted.
--
___
Python tracker <rep...@bugs.python.org>
<https://bugs.pytho
Mark Dickinson <dicki...@gmail.com> added the comment:
[Eric Wieser]
> This would allow the numpy `np.floating` types to take part in `Fraction`
> conversion as well, which would be great.
I'm confused: as far as I can tell, the NumPy floating-point types don't
implement `as_i
Change by Mark Dickinson <dicki...@gmail.com>:
--
title: as_integer_ratio Decimal -> Provide as_integer_ratio() method to Decimal
___
Python tracker <rep...@bugs.python.org>
<https://bugs.py
Change by Mark Dickinson <dicki...@gmail.com>:
--
title: Provide as_integer_ratio() method to Decimal -> as_integer_ratio Decimal
___
Python tracker <rep...@bugs.python.org>
<https://bugs.py
Mark Dickinson <dicki...@gmail.com> added the comment:
Ongoing discussion here:
https://mail.python.org/pipermail/python-dev/2018-March/152358.html
--
___
Python tracker <rep...@bugs.python.org>
<https://bugs.python
Mark Dickinson <dicki...@gmail.com> added the comment:
Why does this issue keep ending up as the target of unrelated PR notifications?
--
___
Python tracker <rep...@bugs.python.org>
<https://bugs.python
Mark Dickinson <dicki...@gmail.com> added the comment:
One quibble with Raymond's response:
> 2) Your use case is trivially solved in a portable, trivial, and readable >
> way:
>
>a == int(a)
For Decimal, I'd recommend using `a == a.to_integral_value()` inste
Mark Dickinson <dicki...@gmail.com> added the comment:
Agreed that this seems wrong.
--
nosy: +eric.smith, mark.dickinson
___
Python tracker <rep...@bugs.python.org>
<https://bugs.python
Mark Dickinson <dicki...@gmail.com> added the comment:
Elias: please do go ahead and update your PR.
--
___
Python tracker <rep...@bugs.python.org>
<https://bugs.python
Mark Dickinson <dicki...@gmail.com> added the comment:
> But I don't know the exact format for infinities and NaNs.
>From the Intel software developer manuals:
For infinities:
Sign bit: 0 or 1 (positive or negative infinity)
Exponent field (15 bits): all ones
Significand (64 bits
Mark Dickinson <dicki...@gmail.com> added the comment:
> What if return 80-bit infinities and NaN as 64-bit infinities and NaN and
> raise an error in the case of finite numbers overflow?
That's certainly reasonable from a pure floating-point-conversion perspective:
it's exac
Mark Dickinson <dicki...@gmail.com> added the comment:
> If left the OverflowError propagated I would catch it at the caller place
> (_read_float() is used only once) and reraise as aifc.Error.
Ah, if there's a dedicated exception type already then yes, agreed that raising
Mark Dickinson <dicki...@gmail.com> added the comment:
> And I think that using math.ldexp() can be more preferable that pow(2.0, ...)
Yes, absolutely agreed. I'll take a look at the PR.
--
___
Python tracker <rep...@bugs.python
Mark Dickinson <dicki...@gmail.com> added the comment:
[Elias Zamaria]
> I see exactly that.
Understood; that's how I interpreted your "changed one test to make sure that
it works". It seems we understand each other. :-)
So yes, one always needs to be very cautious about
Mark Dickinson <dicki...@gmail.com> added the comment:
Serhiy: I think both those results are reasonable, and not too surprising. It
should be easy to understand that the mixed-type operation converts one of the
arguments to float, and if that conversion overflows we get an exc
Mark Dickinson <dicki...@gmail.com> added the comment:
I'm finding it hard to imagine why you'd ever have a sample rate greater than
1e308 in an audio file. (In fact, it's hard to imagine needing a sample rate
greater than 1e6.) Raising an OverflowError for a value that's too large
Mark Dickinson <dicki...@gmail.com> added the comment:
> I'd argue against such a change in any case
And apparently I already did: see issue 22444 for previous discussion on the
topic.
--
___
Python tracker <rep...@bugs.python
Mark Dickinson <dicki...@gmail.com> added the comment:
> It would be a bit strange if mod with a float returns a float and floordiv
> with a float returns an int.
Agreed: if there are floats involved (Fraction // float or float // Fraction),
I think the rule should be that we simp
Mark Dickinson <dicki...@gmail.com> added the comment:
I'm not quite sure why `Fraction_instance % float_instance` wouldn't simply
convert the `Fraction` to a `float` and then use the usual floating-point mod.
There's the issue that you want to maintain consistency with the floordiv
ope
Change by Mark Dickinson <dicki...@gmail.com>:
--
pull_requests: -5653
___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue12345>
___
Change by Mark Dickinson <dicki...@gmail.com>:
--
pull_requests: -5651
___
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue12345>
___
Mark Dickinson <dicki...@gmail.com> added the comment:
> lets change it to make it more approachable to non-native speakers.
Sounds good to me.
--
___
Python tracker <rep...@bugs.python.org>
<https://bugs.pyt
Mark Dickinson <dicki...@gmail.com> added the comment:
Not a typo: it's a valid English word.
http://dictionary.cambridge.org/grammar/british-grammar/linking-words-and-expressions/while-and-whilst
--
nosy: +mark.dickinson
___
Python tracke
Mark Dickinson <dicki...@gmail.com> added the comment:
> and a minimal representation of boolean logic operations that will seem
> natural to anyone, don't you think ?
I'm afraid I don't. :-(
Issue 1: this ABC doesn't seem a good match for Python bools. If I have a
bool
Mark Dickinson <dicki...@gmail.com> added the comment:
This isn't a bug. When you do `Decimal(9.95)`, you're converting the binary
floating-point number `9.95` to a `Decimal` instance. The conversion is
performed exactly, with no change in the value. But the *input* to the
conv
Mark Dickinson <dicki...@gmail.com> added the comment:
Adjusted title (since the Integer <-> Integral rename is the subject of a
separate issue) and versions (since as a new feature, this can't go into Python
3.7, which is already in feature freeze).
--
title: new
Mark Dickinson <dicki...@gmail.com> added the comment:
> This one is common to both python bool and np.bool_.
It's not, though. One of my examples was using `~` (`__invert__`) from the
proposed ABC). And the behaviour of that function differs between NumPy and
Python
I think one of
Mark Dickinson <dicki...@gmail.com> added the comment:
And it's Ned's call, of course, but this smells like a new feature rather than
a fix to me, and I'm not sure why it would be considered special enough to
break the usual release-process rules. Serhiy's point about pickles
Mark Dickinson <dicki...@gmail.com> added the comment:
+1 for the Integer alias, if it can be made to work. The "Integral" name has
always felt clunky and non-obvious to me.
--
nosy: +mark.dickinson
___
Python tracker <rep...@bugs
Mark Dickinson <dicki...@gmail.com> added the comment:
> Is this because of the inf/NaN discrimination hiccups [...]
No, more than that. If it were just that, we could work around it by adding the
appropriate special case handling before calling the libm fma (as has been
done, re
Mark Dickinson <dicki...@gmail.com> added the comment:
> - register numpy bool ('np.bool_') as a virtual subclass of 'Boolean' only
Be aware that np.bool_ behaves differently from Python's bool type in a number
of ways. It may not make sense to have something that tries to abstract o
Mark Dickinson <dicki...@gmail.com> added the comment:
> Do I read this thread correctly assuming that this hasn't been implemented
> yet?
Yes. Existing libm implementations don't work, so simply wrapping the libm
function isn't enough. And writing an implementation from scr
Mark Dickinson <dicki...@gmail.com> added the comment:
@csabella: Agreed. Let's close. Thanks!
--
resolution: -> third party
stage: -> resolved
status: open -> closed
___
Python tracker <rep...@bugs.python.org>
<https://bu
1201 - 1300 of 6765 matches
Mail list logo