Raymond Hettinger added the comment:
> Changing the way isinstance works internally might prove
> beneficial for such tools.
ISTM you're advocating a design change rather than discussing a bug report.
The python-ideas mail list would be a better forum than the tracker.
Raymond Hettinger added the comment:
The OP self-closed the PR.
--
nosy: +rhettinger
resolution: -> rejected
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Raymond Hettinger added the comment:
> The downside of making this change is that it may break 3rd party unit tests.
I don’t see any upside. The modules in question have been stable for a good
while. There’s no benefit to changing them.
Also, there is no strong agreement that the stand
Change by Raymond Hettinger :
--
Removed message: https://bugs.python.org/msg408512
___
Python tracker
<https://bugs.python.org/issue46068>
___
___
Python-bug
Raymond Hettinger added the comment:
> The downside of making this change is that it may break 3rd party unit tests.
I don’t see any upside. The modules in question have been stable for a good
while. There’s no benefit to changing them.
Also, there is no strong agreement that the stand
Change by Raymond Hettinger :
--
status: pending -> closed
___
Python tracker
<https://bugs.python.org/issue25864>
___
___
Python-bugs-list mailing list
Un
Change by Raymond Hettinger :
--
assignee: -> tim.peters
___
Python tracker
<https://bugs.python.org/issue46086>
___
___
Python-bugs-list mailing list
Un
Change by Raymond Hettinger :
--
nosy: +eric.snow
___
Python tracker
<https://bugs.python.org/issue46085>
___
___
Python-bugs-list mailing list
Unsubscribe:
Raymond Hettinger added the comment:
This seems to be a temporary outage, expected to be restored in the first half
of 2022. Source: https://www.usno.navy.mil/USNO/time/master-clock
I'll look for an alternative time source that is currently online.
--
assignee: docs@p
Raymond Hettinger added the comment:
More accurate to say that it aspires to print in a single line ONLY if the
content fits in the specified width. Otherwise, it prints vertically with
appropriate indentation. Indeed, that is the entire purpose of the module;
otherwise, we would just use
Raymond Hettinger added the comment:
I concur with Eric that the current presentation is reasonable and better than
adding boilerplate to every entry. It suffices that the docs cover the *msg*
argument once and that each entry includes *msg* in its signature.
Elsewhere in the docs we
Raymond Hettinger added the comment:
My understanding is that we're holding off on adding the slash notation to the
main docs. The reason is that they are mostly unintelligible to the average
user.
--
nosy: +rhettinger
___
Python tracker
&
Raymond Hettinger added the comment:
I think this note can be removed. The tutorial now has coverage of mutating
while iterating. That is the correct place for discussion of looping
techniques.
The part about the "internal counter" needs to be rewritten and moved to
stdtypes.r
Change by Raymond Hettinger :
--
title: Warning about iterate/modify has unwarranted detail -> Improve SeqIter
documentation
type: enhancement ->
versions: +Python 3.11
___
Python tracker
<https://bugs.python.org/i
Raymond Hettinger added the comment:
For the small cases (say n < 50), we can get faster code by using a small (3Kb)
table of factorial logarithms:
double lf[50] = [log2(factorial(n)) for n in range(50)];
Then comb() and perm() can be computed quickly and in constant time using the
Change by Raymond Hettinger :
--
Removed message: https://bugs.python.org/msg408865
___
Python tracker
<https://bugs.python.org/issue37295>
___
___
Python-bug
Raymond Hettinger added the comment:
For the small cases (say n < 50), we can get faster code by using a small (3Kb)
table of factorial logarithms:
double lf[50] = [log2(factorial(n)) for n in range(50)];
Then comb() and perm() function can be computed quickly and in constant time
us
Change by Raymond Hettinger :
--
nosy: +rhettinger
___
Python tracker
<https://bugs.python.org/issue33567>
___
___
Python-bugs-list mailing list
Unsubscribe:
Raymond Hettinger added the comment:
New changeset aeb9ef4c7287fe367b6e9adcf1c5f994d5bc1a09 by Alex Waygood in
branch 'main':
bpo-46076: Improve documentation for per-attribute docstrings with `__slots__`
(GH-30109)
https://github.com/python/cpyt
Raymond Hettinger added the comment:
Thanks for the PR.
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Raymond Hettinger added the comment:
Thanks for the suggestion, but I also concur with Serhiy.
--
nosy: +rhettinger
resolution: -> rejected
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bug
Raymond Hettinger added the comment:
New changeset 2ef06d412531d1163dbc72877c88aedf3ed82a25 by Matti Picus in branch
'main':
bpo-46131: add fastpath for PyFloat_Check() (#30200)
https://github.com/python/cpython/commit/2ef06d412531d1163dbc72877c88ae
Change by Raymond Hettinger :
--
pull_requests: +28429
pull_request: https://github.com/python/cpython/pull/30208
___
Python tracker
<https://bugs.python.org/issue46
Raymond Hettinger added the comment:
New changeset 29ea68bd1dcf30842c2ed908a6d815bc1d90f484 by Raymond Hettinger in
branch 'main':
Revert "bpo-46131: add fastpath for PyFloat_Check() (GH-30200)" (GH-30208)
https://github.com/python/cpython/commit/29ea68bd1dcf30842c2e
Raymond Hettinger added the comment:
That would not change that slot space is at a premium and that we prefer to use
that space for high payoff optimizations.
--
___
Python tracker
<https://bugs.python.org/issue46
Raymond Hettinger added the comment:
New changeset d7537ac8e3a3ef15d2c5f3fe90e998618b6a97b9 by Miss Islington (bot)
in branch '3.10':
bpo-46076: Improve documentation for per-attribute docstrings with `__slots__`
(GH-30109) (GH-30206)
https://github.com/python/cpyt
Raymond Hettinger added the comment:
New changeset 8bfb11a791679a33024c9857e082afed0d71e0b4 by Miss Islington (bot)
in branch '3.9':
bpo-46076: Improve documentation for per-attribute docstrings with `__slots__`
(GH-30109) (GH-30207)
https://github.com/python/cpyt
Raymond Hettinger added the comment:
> In which case: consider this a feature request to
> consider adding __slots__ ...
A few thoughts:
* Enumerations tend to be small, so a space savings likely isn't relevant.
* In Python 3.11, the speed advantage of slots is now much smaller.
Raymond Hettinger added the comment:
> The problem here is that C gives no guarantees about accuracy of either log2
> or exp2
* The input table has hard-wired constants so there is no dependency on log2().
The inputs can be as exact as pi, tau, and e.
* The C library's exp2
Raymond Hettinger added the comment:
Stand by. I think I can implement this using only bit integer arithmetic. Will
post tomorrow.
--
___
Python tracker
<https://bugs.python.org/issue37
Change by Raymond Hettinger :
--
Removed message: https://bugs.python.org/msg408963
___
Python tracker
<https://bugs.python.org/issue37295>
___
___
Python-bug
Raymond Hettinger added the comment:
> Just curious about why the focus on the newer exp2 and log2?
No particular reason, those happened to give slighy best results on macOS.
Across compilers, plain exp() is likely the most mature.
The quality of log() is irrelevant because it isn
Raymond Hettinger added the comment:
> Finv = [pow(fodd, -1, 2**64) for fodd in Fodd]
This is a good trick. I had already experimented with separating factorials
into an odd component and a shift count, but failed to get a speed-up because
the divisions were slow. Having a table
Raymond Hettinger added the comment:
Am I correct in my understanding the 64 bits are always available, that 128 bit
ints aren't universal, and that #ifdefs would be needed to extend the range of
the table for systems that suppo
Change by Raymond Hettinger :
--
nosy: +pitrou
___
Python tracker
<https://bugs.python.org/issue46148>
___
___
Python-bugs-list mailing list
Unsubscribe:
Raymond Hettinger added the comment:
> can we finally get rid of this language wart
Yes, please. This is a pretty bad pitfall.
I've seen this happen to people who've been conditioned by other languages to
think of assert() as a macro or function:
assert(sometest
Raymond Hettinger added the comment:
[Mark]
> Should I code up my suggestion in a PR,
Yes, go for it.
--
___
Python tracker
<https://bugs.python.org/issu
Raymond Hettinger added the comment:
> "a base class ``B`` following ``A``" shouldn't it be "the base
> class"? . After all, there is at most one base class following ``A``
No. There can be other classes in the chain. The first to match the lookup
wins.
Raymond Hettinger added the comment:
I'm reluctant to give any more space to the least important case, one that
rarely arises in practice. The text in the PR is wordy and IMO creates more
confusion that it solves.
Per the dev-guide, we mostly avoid "preachy" text. No, &qu
Raymond Hettinger added the comment:
> I believe that the behavior is so deeply ingrained in how argparse
> works that it can't be changed.
I think so as well. Handling arguments with a dash prefiew could be viewed as
fundamental design flaw except for the fact that the module
Raymond Hettinger added the comment:
> we should undo the deprecation of optparse in the documentation
> (https://bugs.python.org/issue37103), since the stated justification
> for that deprecation was that optparse will not be developed further.
While optparse that it isn't b
New submission from Raymond Hettinger :
By default, isqrt(n) gives the floor of the exact square of n. It would be
nice to have a flag to give a rounded result:
y = isqrt(n, round=True)
Alternatively, set a mode argument to one of {'floor', 'round', 'ceil&
Raymond Hettinger added the comment:
It's a little late, but I had a thought that code could be made more general,
slightly faster, and much easier to understand if the popcount logic were to be
replaced with a table that records how many bits of the factorial were shifted
out to ma
Raymond Hettinger added the comment:
The shift table is an array of uint8_t, so it would be tiny (nearly fitting in
one cache line).
--
___
Python tracker
<https://bugs.python.org/issue37
Raymond Hettinger added the comment:
Also, it would help Serhiy's divide and conquer algorithm if the fast cases
included the sides of Pascal's triangle rather than just the top:
if n < TableSize and k < limits[n]:
return comb_small(n, k)
return comb_slow(n, k)
Raymond Hettinger added the comment:
> Sweet! New one on me
Tim already knows this but for the record the derivation is isn't tricky.
With y=isqrt(x), then next root is at y+1 and the half way point is y+1/2 which
isn't an integer. The corresponding squares are y**2, (y+1/2)*
Raymond Hettinger added the comment:
If all you want is a sample where k==1, then use choice(). That is clearer and
more efficient.
The sample() function is for sampling without replacement which only makes
sense when k > 1; otherwise, choice() or choices() is usually what you w
Raymond Hettinger added the comment:
Okay. Thank for the quick response and the suggestion. I'm going to mark this
one as closed. AFAICT, it distracts users from better solutions.
I did a quick code search for sample(). The k==1 case is rare and in most
cases the code should have
Raymond Hettinger added the comment:
> My suggestion is not to set k=1 when omitted but to assign it a random value
Sorry, I think that is just bizarre. Also, some populations are *very* large,
so a minor user accident of omitting a parameter would result in a large
unexpected out
Raymond Hettinger added the comment:
The use case isn't bizarre. But having an API where that is the default
behavior would be. From the point of view of most users, such an API would be
unusual and surprising (I don't know of any other random package that has such
Raymond Hettinger added the comment:
> So use decimal's ROUND_CEILING, ROUND_FLOOR, and ROUND_HALF_EVEN
It think is would suck to have to type those out. Sorry, I think you're headed
down the path of foolish consistency with an unrelated module and a more
complicated topic.
Raymond Hettinger added the comment:
I'm going to decline this one.
* It is arguable whether or not this behavior should have been designed in
originally. However, changing it now is risky (as noted by Brett and Ethan).
* Personally, I disagree with the notion of allowing a partial
Change by Raymond Hettinger :
--
assignee: -> rhettinger
___
Python tracker
<https://bugs.python.org/issue43639>
___
___
Python-bugs-list mailing list
Un
Raymond Hettinger added the comment:
- if comb(n, k) != comb_small(n, k):
+ if comb(n, k) != comb_small(n, k) % Modulus:
--
___
Python tracker
<https://bugs.python.org/issue37
Raymond Hettinger added the comment:
> Did you try running that?
Yes. The table size was extended beyond what we have now. See attached file.
--
Added file: https://bugs.python.org/file50526/comb_with_side_limits.py
___
Python tracker
<
Raymond Hettinger added the comment:
> I'd be happy to change the implementation to use the trailing
> zero counts as suggested.
Thanks. I think that is a portability win and will made the code a lot easier
to explain.
--
___
Pyt
Raymond Hettinger added the comment:
> I'd similarly prefer to see recipes in the docs.
Can you elaborate on why you prefer having this in the docs rather than as
built-in functionality?
For me, the rounded case would be the most common. I don't think I'm
better-off writ
Raymond Hettinger added the comment:
So, are you going to reject my feature request? I don't understand why. Both
Mark and I have had valid use cases. The implementation is straight-forward
and simple. The workaround is slow and non-obvious. The default remains the
same so
Raymond Hettinger added the comment:
I'm thinking of this an a replacement example:
>>> import json
>>> import urllib.request
>>> url = "http://worldtimeapi.org/api/timezone/America/Los_Angeles";
>>> with urllib.request.urlopen(url)
Raymond Hettinger added the comment:
This is a little closer to the current code. Also it has a simpler and more
universal url.
from urllib.request import urlopen
url = 'http://worldtimeapi.org/api/timezone/etc/UTC.txt'
with urlopen(url) as request:
for line in request:
Raymond Hettinger added the comment:
Withdrawing the suggestions for scaled_to() and scaled_by(). Am thinking that
people are mostly better off with a dict comprehension where they can control
the details of rounding and type conversions.
--
resolution: -> rejected
stage: pa
Raymond Hettinger added the comment:
To the list of four options I suggested for bidict, you can add one more.
Create a feature request for a C implementation of collections.abc.KeyView.
ISTM that your core issue is that bidict won't use the intended and guaranteed
solution becaus
Change by Raymond Hettinger :
--
keywords: +patch
pull_requests: +28532
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/30315
___
Python tracker
<https://bugs.python.org/issu
Change by Raymond Hettinger :
--
keywords: +patch
pull_requests: +28533
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/30316
___
Python tracker
<https://bugs.python.org/issu
Raymond Hettinger added the comment:
New changeset ac4eea21722d9ed1604c9c30a8d29ae2ce74f1b2 by Raymond Hettinger in
branch 'main':
bpo-46079: Replace external link that is down for maintenance. (GH-30315)
https://github.com/python/cpython/commit/ac4eea21722d9ed1604c9c30a8d29a
Raymond Hettinger added the comment:
New changeset 2bd73546959619b2519a7a830b3aaf190abeaf78 by Miss Islington (bot)
in branch '3.10':
bpo-46079: Replace external link that is down for maintenance. (GH-30315)
(GH-30328)
https://github.com/python/cpyt
Raymond Hettinger added the comment:
New changeset 72ffcb02f3ea6efcd3afe368996dc3ee89701898 by Miss Islington (bot)
in branch '3.9':
bpo-46079: Replace external link that is down for maintenance. (GH-30315)
(GH-30329)
https://github.com/python/cpyt
Change by Raymond Hettinger :
--
priority: low -> normal
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python
Raymond Hettinger added the comment:
New changeset a09bc3a404befca197b5d9959a9c62110ee61d77 by Raymond Hettinger in
branch 'main':
bpo-46095: Improve SeqIter documentation. (GH-30316)
https://github.com/python/cpython/commit/a09bc3a404befca197b5d9959a9c62
Change by Raymond Hettinger :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Raymond Hettinger added the comment:
New changeset e9783d6434f28dfb0b531c6760f7642fc7ede278 by Miss Islington (bot)
in branch '3.10':
bpo-46095: Improve SeqIter documentation. (GH-30316) (GH-30330)
https://github.com/python/cpython/commit/e9783d6434f28dfb0b531c6760f764
Change by Raymond Hettinger :
--
assignee: docs@python -> rhettinger
___
Python tracker
<https://bugs.python.org/issue46224>
___
___
Python-bugs-list mai
Raymond Hettinger added the comment:
I'm going to decline this one. It seems that you're applying a stylistic
guideline to a case where it isn't needed and where it doesn't improve the
example.
In this case, the example doesn't mutate the input, so the code
Raymond Hettinger added the comment:
Thank you for the PR.
--
nosy: +rhettinger
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Raymond Hettinger added the comment:
> divmod() allows easy emulation of any division rounding mode
It could be used that way, but generally isn't.
Please consider my original request. Adding a keyword argument is easy, clear,
and has almost no mental overhead.
It reads very
Raymond Hettinger added the comment:
I don't think this is a door we should open:
>>> Fraction(3.5, 2.5)
Fraction(7, 5)
This currently raises a useful exception:
TypeError: both arguments should be Rational instances
That is especially helpful in avoiding c
Change by Raymond Hettinger :
--
assignee: docs@python -> rhettinger
resolution: -> not a bug
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python
New submission from Raymond Hettinger :
The existing code makes two passes, one to compute the mean and another to
compute the sum of squared differences from the mean. A consequence of making
two passes is that iterator inputs must be converted to a list before
processing. This throws
Change by Raymond Hettinger :
--
keywords: +patch
pull_requests: +28611
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/30403
___
Python tracker
<https://bugs.python.org/issu
Raymond Hettinger added the comment:
The two numbers you gave become the same when rounded to the limited internal
precision used by floats.
>>> 1.12345678901234 == 1.123456789011
True
When it comes to displaying the number, Python tries to show the shortest
possible memb
Raymond Hettinger added the comment:
New changeset 43aac29cbbb8a963a22c334b5b795d1e43417d6b by Raymond Hettinger in
branch 'main':
bpo-46257: Convert statistics._ss() to a single pass algorithm (GH-30403)
https://github.com/python/cpython/commit/43aac29cbbb8a963a22c334b5b795d
Change by Raymond Hettinger :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Raymond Hettinger added the comment:
I don't think these were intended to be public. like "January" and "February",
they were for internal use. Presumably, this is because the names vary across
languages.
In the absence of some demonstrated user need, w
Change by Raymond Hettinger :
--
resolution: -> rejected
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Raymond Hettinger added the comment:
> The problem is they are documented here:
> https://docs.python.org/3/library/calendar.html#calendar.setfirstweekday
Well, that does make them public, so we have to go forward.
--
resolution: rejected ->
status: close
Change by Raymond Hettinger :
--
assignee: docs@python -> rhettinger
nosy: +rhettinger
___
Python tracker
<https://bugs.python.org/issue46270>
___
___
Python-
New submission from Raymond Hettinger :
In the section "Comparison operators", all mentions of "bitwise" should be
"binary".
The section "Logical operators" should be retitled "Bitwise operators". See:
https://docs.python.org/3/re
Raymond Hettinger added the comment:
It may seem weird, but a "membership operator" is a kind of "comparison
operator".¹ They can even participate in chaining, 'a < b in s < c` is
equivalent to `(a < b) and (b in s) and (b < c)`.
I'm propose
Raymond Hettinger added the comment:
New changeset e5894ca8fd05e6a6df1033025b9093b68baa718d by Nikita Sobolev in
branch 'main':
bpo-46266: Add calendar day of week constants to __all__ (GH-30412)
https://github.com/python/cpython/commit/e5894ca8fd05e6a6df1033025b9093
Raymond Hettinger added the comment:
Thanks for the PR. Sorry that I missed the one public reference in the docs.
--
resolution: -> fixed
status: open -> closed
versions: -Python 3.10, Python 3.9
___
Python tracker
<https://bugs.p
Raymond Hettinger added the comment:
Container is correct. Containers are defined as being anything that supports
the "in" and "not in" operators. That includes sequences (str, list, tuple,
bytes, bytearray), mappings (dict, ChainMap, defaultdict), and sets (froz
Raymond Hettinger added the comment:
> comparison::= or_expr (comp_operator or_expr)*
So, the meaning of these names like this is, "lt followed by an optional
bitwise_or expression"?
compare_op_bitwise_or_pair[CmpopExprPair*]:
| eq_bitwise_or
| not
Raymond Hettinger added the comment:
#244 is a false positive. The value of new_state[i] on line 454 was
initialized on line 442 with: new_state[i] = (uint32_t)element.
#387 is also a false positive. There is an assertion on the previous line that
the item != NULL. That assertion passes
Raymond Hettinger added the comment:
#324 and #325 are false positives. The result variable is initialized in the
preceding lines:
if (len_a == length) {
left = *((volatile const unsigned char**)&a);
result = 0;
}
if (len_a != length) {
left
Raymond Hettinger added the comment:
#382 is false positive. The "iterable" variable is only accessed when known to
not be NULL.
# Line 970
if (iterable != NULL) {
if (set_update_internal(so, iterable)) {
Py_DECREF(so);
r
Raymond Hettinger added the comment:
#420 and #421 are false positives. The value of "c" is initialized a few lines
before use.
for (;;) {
c = tok_nextc(tok);
...
}
...
tok_backup(tok, c);
if (c == '#
Raymond Hettinger added the comment:
The dead store notices for all the DISPATCH calls in ceval.c are false
positives. The "oparg" value is used in many of the case statements.
The dead store notices the clinic generated code all relate to "!--noptargs"
which is sometim
Raymond Hettinger added the comment:
#511 and #512 are false positives. The "kind" variable is indeed uninitialized
in the bytes_writer case:
else if (bytes_writer) {
*bytes_str = _PyBytesWriter_Prepare(bytes_writer, *bytes_str, strlen);
if (*bytes_s
Raymond Hettinger added the comment:
#533, #534, #535, and #536 are false positives for the same reason as #511 and
#512. The two "dead stores" in 533 and 534 match the "uninitialized variables"
in 535 and 536.
--
___
Py
Raymond Hettinger added the comment:
#584 and #585: The code is correct but there are dead stores only when the
asserts are turned off:
2635. carry = v_lshift(w->ob_digit, w1->ob_digit, size_w, d);
2636. assert(carry == 0);
Elsewhere we use ifdefs around code like t
1 - 100 of 9609 matches
Mail list logo