[issue46486] Rename DesciptorClassification => DescriptorClassification in specialize.c

2022-01-23 Thread Raymond Hettinger
Raymond Hettinger added the comment: Thanks for noticing this and submitting a PR. -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue46486] Rename DesciptorClassification => DescriptorClassification in specialize.c

2022-01-23 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset d1beb241d9bdf912682bc8323a59c052f99b82a8 by Kumar Aditya in branch 'main': bpo-46486: Fixed misspelled name DesciptorClassification https://github.com/python/cpython/commit/d1beb241d9bdf912682bc8323a59c052f99b82a8 -- nosy

[issue46376] PyMapping_Check returns 1 for list

2022-01-23 Thread Raymond Hettinger
Raymond Hettinger added the comment: I would really like this to be left alone. We've been without a reliable version for over a decade. That is strong evidence that we really don't need this unless it can be done perfectly (which it can't). Also, PyMapping_Check is just a CPython

[issue42161] Remove private _PyLong_Zero and _PyLong_One variables

2022-01-18 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset 243c31667cc15a9a338330ad9b2a29b1cd1c76ec by Raymond Hettinger in branch 'main': bpo-42161: Hoist the _PyLong_GetOne() call out of the inner loop. (GH-30656) https://github.com/python/cpython/commit/243c31667cc15a9a338330ad9b2a29b1cd1c76ec

[issue42161] Remove private _PyLong_Zero and _PyLong_One variables

2022-01-17 Thread Raymond Hettinger
Change by Raymond Hettinger : -- pull_requests: +28857 pull_request: https://github.com/python/cpython/pull/30656 ___ Python tracker <https://bugs.python.org/issue42

[issue46406] optimize int division

2022-01-16 Thread Raymond Hettinger
Change by Raymond Hettinger : -- nosy: +rhettinger, tim.peters ___ Python tracker <https://bugs.python.org/issue46406> ___ ___ Python-bugs-list mailing list Unsub

[issue46399] Addition of `mapping` attribute to dict views classes has inadvertently broken type-checkers

2022-01-16 Thread Raymond Hettinger
Raymond Hettinger added the comment: > I propose that two changes be made to `dict_keys`, `dict_values` > and `dict_items`: > > * They should be officially exposed in the `types` module. > * `__class_getitem__` should be added to t

[issue46387] `test_field_descriptor` in `test_collections` should test all pickle protocols

2022-01-15 Thread Raymond Hettinger
Raymond Hettinger added the comment: I approved this but the code wasn't wrong. Once an object has demonstrated that it can pickle at all, it is the testing responsibility of the pickle module tests to make sure that new protocols handle the same inputs as the old ones. I went ahead

[issue46387] `test_field_descriptor` in `test_collections` should test all pickle protocols

2022-01-15 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset 37eab55ac9da6b6361f136a1da15bfcef12ed954 by Nikita Sobolev in branch 'main': bpo-46387: test all pickle protos in `test_field_descriptor` in `test_collections` (GH-30614) https://github.com/python/cpython/commit

[issue46388] Improve test coverage of functools.total_ordering

2022-01-15 Thread Raymond Hettinger
Raymond Hettinger added the comment: Thanks for the PR. -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue46388] Improve test coverage of functools.total_ordering

2022-01-15 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset 0a28118324f64851b684ec3afdd063c47513a236 by Russel Webber in branch 'main': bpo-46388: Test NotImplemented code path for functools.total_ordering (GH-30616) https://github.com/python/cpython/commit/0a28118324f64851b684ec3afdd063c47513a236

[issue46372] int/float specializations should mutate the LHS in-place when possible

2022-01-15 Thread Raymond Hettinger
Change by Raymond Hettinger : -- nosy: +vstinner ___ Python tracker <https://bugs.python.org/issue46372> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue46388] Improve test coverage of functools.total_ordering

2022-01-15 Thread Raymond Hettinger
Change by Raymond Hettinger : -- assignee: -> rhettinger ___ Python tracker <https://bugs.python.org/issue46388> ___ ___ Python-bugs-list mailing list Un

[issue46376] PyMapping_Check returns 1 for list

2022-01-15 Thread Raymond Hettinger
Change by Raymond Hettinger : -- assignee: rhettinger -> ___ Python tracker <https://bugs.python.org/issue46376> ___ ___ Python-bugs-list mailing list Un

[issue46376] PyMapping_Check returns 1 for list

2022-01-14 Thread Raymond Hettinger
Raymond Hettinger added the comment: Here's question to focus on: In what circumstances should a developer ever prefer PyMapping_Check() over PyType_HasFeature() with Py_TPFLAGS_MAPPING? The latter doesn't give any new, useful information: return o && Py_TYPE(o)->tp

[issue46376] PyMapping_Check returns 1 for list

2022-01-14 Thread Raymond Hettinger
Raymond Hettinger added the comment: > what about simply excluding TPFLAGS_MAPPING from PySequence > and TPFLAGS_Sequence from PyMapping? It will remove the types > that are 100% not sequences or mappings, as these flags > are mutually exclusive by definition. This is more pl

[issue46376] PyMapping_Check returns 1 for list

2022-01-14 Thread Raymond Hettinger
Raymond Hettinger added the comment: s/it isn't work breaking other things/it isn't worth breaking other things/ -- ___ Python tracker <https://bugs.python.org/issue46

[issue46376] PyMapping_Check returns 1 for list

2022-01-14 Thread Raymond Hettinger
Raymond Hettinger added the comment: > It changes behavior for objects not being iterable/sequences > if not inheriting from `abc.collections.Sequence`. This would be a breaking change (for example, it broke the long stable sre_parse code). The utility of PySequence

[issue46380] `test_functools.TestLRU` must not use `functools` module directly

2022-01-14 Thread Raymond Hettinger
Change by Raymond Hettinger : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue46380] `test_functools.TestLRU` must not use `functools` module directly

2022-01-14 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset c5640ef87511c960e339af37b486678788be910a by Nikita Sobolev in branch 'main': bpo-46380: Apply tests to both C and Python version (GH-30606) https://github.com/python/cpython/commit/c5640ef87511c960e339af37b486678788be910a

[issue46379] itertools.product reference implementation creates temporaries

2022-01-14 Thread Raymond Hettinger
Raymond Hettinger added the comment: Please do keep looking for improvements. Suggestions are always welcome. -- ___ Python tracker <https://bugs.python.org/issue46

[issue46379] itertools.product reference implementation creates temporaries

2022-01-14 Thread Raymond Hettinger
Raymond Hettinger added the comment: Markus, thank you for the suggestion but I'm going to decline. When this rough equivalent was first created, we looked at several recipes and chose this one as being one of the least magical. Intentionally, we did not use the variant you've proposed

[issue46379] itertools.product reference implementation creates temporaries

2022-01-14 Thread Raymond Hettinger
Change by Raymond Hettinger : -- assignee: docs@python -> rhettinger ___ Python tracker <https://bugs.python.org/issue46379> ___ ___ Python-bugs-list mai

[issue46380] `test_functools.TestLRU` must not use `functools` module directly

2022-01-14 Thread Raymond Hettinger
Change by Raymond Hettinger : -- assignee: -> rhettinger nosy: +rhettinger ___ Python tracker <https://bugs.python.org/issue46380> ___ ___ Python-bugs-lis

[issue37295] Possible optimizations for math.comb()

2022-01-12 Thread Raymond Hettinger
Change by Raymond Hettinger : Added file: https://bugs.python.org/file50559/comb_pole2.py ___ Python tracker <https://bugs.python.org/issue37295> ___ ___ Python-bug

[issue37295] Possible optimizations for math.comb()

2022-01-12 Thread Raymond Hettinger
Raymond Hettinger added the comment: def comb64(n, k): 'comb(n, k) in multiplicative group modulo 64-bits' return (F[n] * Finv[k] * Finv[n-k] & (2**64-1)) << (S[n] - S[k] - S[n - k]) def comb_iterative(n, k): 'Straight multiply and divide when k is small.' result = 1

[issue37295] Possible optimizations for math.comb()

2022-01-12 Thread Raymond Hettinger
Raymond Hettinger added the comment: Okay, will set a cap on the n where a fixedj is used. Also, making a direct computation for k<20 is promising. -- ___ Python tracker <https://bugs.python.org/issu

[issue37295] Possible optimizations for math.comb()

2022-01-12 Thread Raymond Hettinger
Change by Raymond Hettinger : -- Removed message: https://bugs.python.org/msg410440 ___ Python tracker <https://bugs.python.org/issue37295> ___ ___ Python-bug

[issue46361] Small ints aren't always cached properly

2022-01-12 Thread Raymond Hettinger
Change by Raymond Hettinger : -- nosy: +rhettinger ___ Python tracker <https://bugs.python.org/issue46361> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue37295] Possible optimizations for math.comb()

2022-01-12 Thread Raymond Hettinger
Raymond Hettinger added the comment: ISTM that the asymptotic benefits of Karatsuba multiplication are mostly lost when each of the factors has to be built-up recursively prior to the multiply. Also, the benefits of Karatsuba only start to appear at around 400-bit numbers. For us, we don't

[issue37295] Possible optimizations for math.comb()

2022-01-12 Thread Raymond Hettinger
Raymond Hettinger added the comment: Ran some timings on the pure python version with and without the precomputed diagonal: [C(n, k) for k in range(n+1)] New CodeBaseline - - n=85 156 usec160 usec n=137 632 usec 1.82

[issue37295] Possible optimizations for math.comb()

2022-01-11 Thread Raymond Hettinger
Change by Raymond Hettinger : Removed file: https://bugs.python.org/file50556/comb_pole.py ___ Python tracker <https://bugs.python.org/issue37295> ___ ___ Python-bug

[issue37295] Possible optimizations for math.comb()

2022-01-11 Thread Raymond Hettinger
Raymond Hettinger added the comment: Just posted an update that runs on 3.8 or later. -- Added file: https://bugs.python.org/file50557/comb_pole.py ___ Python tracker <https://bugs.python.org/issue37

[issue37295] Possible optimizations for math.comb()

2022-01-11 Thread Raymond Hettinger
Raymond Hettinger added the comment: One fixup: - j = min(k // 2, FixedJ) + j = FixedJ if k > FixedJ else k // 2 With that fix, the number of 64-bit mod arithmetic calls drops to 3, 4, and 20 for C(200,100), C(225,112), and C(250,125). The compares to 115, 150, and 193 ca

[issue37295] Possible optimizations for math.comb()

2022-01-11 Thread Raymond Hettinger
Change by Raymond Hettinger : Removed file: https://bugs.python.org/file50555/comb_pole.py ___ Python tracker <https://bugs.python.org/issue37295> ___ ___ Python-bug

[issue37295] Possible optimizations for math.comb()

2022-01-11 Thread Raymond Hettinger
Raymond Hettinger added the comment: I've been experimenting with a modification of Serhiy's recurrence relation, using a different value of j rather than j=k//2. The current design splits-off three ways when it recurses, so the number of calls grows quickly. For C(200,100), C(225,112

[issue46334] Glossary URLs with anchor link no longer jump to definitions

2022-01-10 Thread Raymond Hettinger
Change by Raymond Hettinger : -- nosy: +rhettinger ___ Python tracker <https://bugs.python.org/issue46334> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue46330] Simplify the signature of __exit__

2022-01-10 Thread Raymond Hettinger
Raymond Hettinger added the comment: Implementation and transition issues aside, I like this idea. People can mostly just use isinstance() checks to match one or more exception types. Also, the single argument form would work well with structural pattern matching: def __exit__(self

[issue46270] Comparison operators in Python Tutorial 5.7

2022-01-09 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset 2e6798f35260ff90129861ef1f289ac40c0396c2 by Miss Islington (bot) in branch '3.10': bpo-46270: Describe the `in` and `not in` operators as membership tests. (GH-30504) (GH-30509) https://github.com/python/cpython/commit

[issue46270] Comparison operators in Python Tutorial 5.7

2022-01-09 Thread Raymond Hettinger
Change by Raymond Hettinger : -- stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue46270> ___ ___ Pyth

[issue46270] Comparison operators in Python Tutorial 5.7

2022-01-09 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset d24cd49acb25c36db31893b84d0ca4fe2f373b94 by Raymond Hettinger in branch 'main': bpo-46270: Describe the `in` and `not in` operators as membership tests. (GH-30504) https://github.com/python/cpython/commit

[issue46270] Comparison operators in Python Tutorial 5.7

2022-01-09 Thread Raymond Hettinger
Change by Raymond Hettinger : -- keywords: +patch pull_requests: +28709 stage: -> patch review pull_request: https://github.com/python/cpython/pull/30504 ___ Python tracker <https://bugs.python.org/issu

[issue46272] Fix bitwise and logical terminology in python.gram

2022-01-09 Thread Raymond Hettinger
Change by Raymond Hettinger : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue46307] string.Template should allow inspection of identifiers

2022-01-08 Thread Raymond Hettinger
Change by Raymond Hettinger : -- nosy: +barry ___ Python tracker <https://bugs.python.org/issue46307> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue46280] About vulnerabilities in Cpython native code

2022-01-06 Thread Raymond Hettinger
Raymond Hettinger added the comment: Update on #324 and #325. Not only are these false positives, but Serhiy pointed-out the existing logic is intentional and should not be rewritten. -- ___ Python tracker <https://bugs.python.org/issue46

[issue46280] About vulnerabilities in Cpython native code

2022-01-06 Thread Raymond Hettinger
Change by Raymond Hettinger : -- keywords: +patch pull_requests: +28651 stage: -> patch review pull_request: https://github.com/python/cpython/pull/30445 ___ Python tracker <https://bugs.python.org/issu

[issue46280] About vulnerabilities in Cpython native code

2022-01-06 Thread Raymond Hettinger
Raymond Hettinger added the comment: #654 is a false positive. The value of ptrs[0] is initialized to NULL via a pointer alias a few lines before: pp = ptrs; ... *pp = NULL; ... if (ptrs[0] == NULL) -- ___ Python tracker

[issue46280] About vulnerabilities in Cpython native code

2022-01-06 Thread Raymond Hettinger
Raymond Hettinger added the comment: #632 should be left as is. Technically, the second "field++" is a dead store. However, it is harmless and has some advantages. It keeps the the assignments parallel and it reduces the chance of introducing a new bug if a new field is added

[issue46280] About vulnerabilities in Cpython native code

2022-01-06 Thread Raymond Hettinger
Raymond Hettinger added the comment: #606 is similar to #584 and #585. The "dead store" is used only in an assertion: have_dict = 1;<== Presumed dead store } assert(have_dict);<== Used in an assert In the case, it would be reasonable

[issue46280] About vulnerabilities in Cpython native code

2022-01-06 Thread Raymond Hettinger
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 cod

[issue46280] About vulnerabilities in Cpython native code

2022-01-06 Thread Raymond Hettinger
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

[issue46280] About vulnerabilities in Cpython native code

2022-01-06 Thread Raymond Hettinger
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

[issue46280] About vulnerabilities in Cpython native code

2022-01-06 Thread Raymond Hettinger
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

[issue46280] About vulnerabilities in Cpython native code

2022-01-06 Thread Raymond Hettinger
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 == '#' || c ==

[issue46280] About vulnerabilities in Cpython native code

2022-01-06 Thread Raymond Hettinger
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

[issue46280] About vulnerabilities in Cpython native code

2022-01-06 Thread Raymond Hettinger
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**)); result = 0; } if (len_a != length) { left = b

[issue46280] About vulnerabilities in Cpython native code

2022-01-06 Thread Raymond Hettinger
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

[issue46272] Fix bitwise and logical terminology in python.gram

2022-01-06 Thread Raymond Hettinger
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

[issue46270] Comparison operators in Python Tutorial 5.7

2022-01-05 Thread Raymond Hettinger
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

[issue46266] Improve day constants (`MONDAY` ... `SUNDAY`) in `calendar.py`

2022-01-05 Thread Raymond Hettinger
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

[issue46266] Improve day constants (`MONDAY` ... `SUNDAY`) in `calendar.py`

2022-01-05 Thread Raymond Hettinger
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/e5894ca8fd05e6a6df1033025b9093b68baa718d

[issue46270] Comparison operators in Python Tutorial 5.7

2022-01-05 Thread Raymond Hettinger
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 this ne

[issue46272] Fix bitwise and logical terminology in python.gram

2022-01-05 Thread Raymond Hettinger
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

[issue46270] Comparison operators in Python Tutorial 5.7

2022-01-05 Thread Raymond Hettinger
Change by Raymond Hettinger : -- assignee: docs@python -> rhettinger nosy: +rhettinger ___ Python tracker <https://bugs.python.org/issue46270> ___ ___ Python-

[issue46266] Improve day constants (`MONDAY` ... `SUNDAY`) in `calendar.py`

2022-01-05 Thread Raymond Hettinger
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

[issue46266] Improve day constants (`MONDAY` ... `SUNDAY`) in `calendar.py`

2022-01-05 Thread Raymond Hettinger
Change by Raymond Hettinger : -- resolution: -> rejected stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue46266] Improve day constants (`MONDAY` ... `SUNDAY`) in `calendar.py`

2022-01-05 Thread Raymond Hettinger
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, we sho

[issue46257] Convert statistics sum of squares to a single pass algorithm

2022-01-05 Thread Raymond Hettinger
Change by Raymond Hettinger : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue46257] Convert statistics sum of squares to a single pass algorithm

2022-01-05 Thread Raymond Hettinger
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/43aac29cbbb8a963a22c334b5b795d1e43417d6b

[issue46259] float formatting error?

2022-01-04 Thread Raymond Hettinger
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 possib

[issue46257] Convert statistics sum of squares to a single pass algorithm

2022-01-04 Thread Raymond Hettinger
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

[issue46257] Convert statistics sum of squares to a single pass algorithm

2022-01-04 Thread Raymond Hettinger
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

[issue46182] `super` and descriptor clarification

2022-01-02 Thread Raymond Hettinger
Change by Raymond Hettinger : -- assignee: docs@python -> rhettinger resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python

[issue37836] Support .as_integer_ratio() in fractions.Fraction

2022-01-02 Thread Raymond Hettinger
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

[issue46187] Optionally support rounding for math.isqrt()

2022-01-02 Thread Raymond Hettinger
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 w

[issue46228] argparse docs: default for prog= in ArgumentParser() should be basename of argv[0], not argv[0], to match behaviour

2022-01-02 Thread Raymond Hettinger
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

[issue46224] doc: Fix bisect example using mutable function default

2022-01-02 Thread Raymond Hettinger
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 is correct. It has some

[issue46224] doc: Fix bisect example using mutable function default

2022-01-02 Thread Raymond Hettinger
Change by Raymond Hettinger : -- assignee: docs@python -> rhettinger ___ Python tracker <https://bugs.python.org/issue46224> ___ ___ Python-bugs-list mai

[issue46095] Improve SeqIter documentation

2022-01-01 Thread Raymond Hettinger
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/e9783d6434f28dfb0b531c6760f7642fc7ede278

[issue46095] Improve SeqIter documentation

2022-01-01 Thread Raymond Hettinger
Change by Raymond Hettinger : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue46095] Improve SeqIter documentation

2022-01-01 Thread Raymond Hettinger
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/a09bc3a404befca197b5d9959a9c62110ee61d77

[issue46079] [doc] Broken URL in "Brief Tour of the Standard Library"

2022-01-01 Thread Raymond Hettinger
Change by Raymond Hettinger : -- priority: low -> normal resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python

[issue46079] [doc] Broken URL in "Brief Tour of the Standard Library"

2022-01-01 Thread Raymond Hettinger
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/cpython/commit

[issue46079] [doc] Broken URL in "Brief Tour of the Standard Library"

2022-01-01 Thread Raymond Hettinger
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/cpython/commit

[issue46079] [doc] Broken URL in "Brief Tour of the Standard Library"

2022-01-01 Thread Raymond Hettinger
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/ac4eea21722d9ed1604c9c30a8d29ae2ce74f1b2

[issue46095] Improve SeqIter documentation

2021-12-31 Thread Raymond Hettinger
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

[issue46079] [doc] Broken URL in "Brief Tour of the Standard Library"

2021-12-31 Thread Raymond Hettinger
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

[issue45670] New .mapping attribute is broken for some existing uses of dict views

2021-12-31 Thread Raymond Hettinger
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 because

[issue25478] Consider adding a normalize() method to collections.Counter()

2021-12-31 Thread Raymond Hettinger
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

[issue46079] [doc] Broken URL in "Brief Tour of the Standard Library"

2021-12-31 Thread Raymond Hettinger
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: line

[issue46079] [doc] Broken URL in "Brief Tour of the Standard Library"

2021-12-30 Thread Raymond Hettinger
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) as respon

[issue46187] Optionally support rounding for math.isqrt()

2021-12-30 Thread Raymond Hettinger
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

[issue46187] Optionally support rounding for math.isqrt()

2021-12-30 Thread Raymond Hettinger
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 writing a wrap

[issue37295] Possible optimizations for math.comb()

2021-12-30 Thread Raymond Hettinger
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. -- ___ Python t

[issue37295] Possible optimizations for math.comb()

2021-12-29 Thread Raymond Hettinger
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 <

[issue37295] Possible optimizations for math.comb()

2021-12-29 Thread Raymond Hettinger
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

[issue43639] Do not raise AttributeError on instance attribute update/deletion if data descriptor with missing __set__/__delete__ method found on its type

2021-12-29 Thread Raymond Hettinger
Change by Raymond Hettinger : -- assignee: -> rhettinger ___ Python tracker <https://bugs.python.org/issue43639> ___ ___ Python-bugs-list mailing list Un

[issue43639] Do not raise AttributeError on instance attribute update/deletion if data descriptor with missing __set__/__delete__ method found on its type

2021-12-29 Thread Raymond Hettinger
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 pass

[issue46187] Optionally support rounding for math.isqrt()

2021-12-29 Thread Raymond Hettinger
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. What's wr

[issue46190] Omit k in random.sample()

2021-12-29 Thread Raymond Hettinger
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 a default

<    1   2   3   4   5   6   7   8   9   10   >