[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: #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: #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
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: 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

[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:

[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

[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

[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/cpyt

[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 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/cpyt

[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

[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:

[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),

[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: 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 calls

[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
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-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-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&#

[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
Change by Raymond Hettinger : -- Removed message: https://bugs.python.org/msg410440 ___ 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: 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
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.&

[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

[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

[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

[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'v

[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

[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/c5640ef87511c960e339af37b48667

[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

[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_Che

[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.o

[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: 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

[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

[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

[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
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/0a28118324f64851b684ec3afdd063

[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

[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/cpyt

[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 ahea

[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

[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

[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

[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/243c31667cc15a9a338330ad9b2a29

[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

[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 -

[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

[issue46488] listsort.txt wrongly assumes you cannot calculate leading zeros in O(1) time.

2022-01-23 Thread Raymond Hettinger
Raymond Hettinger added the comment: Presumably the OP is referring to this text: """ `powerloop()` emulates these divisions, 1 bit at a time, using comparisons, subtractions, and shifts in a loop. You'll notice the paper uses an O(1) method instead, but that relies on

[issue37295] Possible optimizations for math.comb()

2022-01-23 Thread Raymond Hettinger
Raymond Hettinger added the comment: > But I won't post code (unless someone asks) Okay, I'll ask. -- ___ Python tracker <https://bugs.pytho

[issue46488] listsort.txt wrongly assumes you cannot calculate leading zeros in O(1) time.

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

[issue33205] GROWTH_RATE prevents dict shrinking

2022-01-24 Thread Raymond Hettinger
Raymond Hettinger added the comment: Should this have been "filled*3" rather than "used*3"? The intent was to give a larger resize to dict that had a lot of dummy entries and a smaller resize to dicts without deletions. -- __

[issue46527] enumerate no longer accepts iterable keyword argument

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

[issue33205] GROWTH_RATE prevents dict shrinking

2022-01-25 Thread Raymond Hettinger
Change by Raymond Hettinger : -- status: closed -> open ___ Python tracker <https://bugs.python.org/issue33205> ___ ___ Python-bugs-list mailing list Un

[issue46574] itertools.count should work with non-number types

2022-01-29 Thread Raymond Hettinger
Raymond Hettinger added the comment: Thanks for the suggestion but I'm going to decline. * The need for this is very low. * It's easy to roll your own. * The code for `count('', 'a')` and `count((), (1,))` isn't intelligible. * Without special casing

[issue46554] Add append keyword argument to Path.write_text() and Path.write_bytes()

2022-01-31 Thread Raymond Hettinger
Raymond Hettinger added the comment: I concur with Serhiy. -- nosy: +pitrou, rhettinger ___ Python tracker <https://bugs.python.org/issue46554> ___ ___ Pytho

[issue46561] Descriptor resolution should own arguments passed to descriptors

2022-02-01 Thread Raymond Hettinger
Raymond Hettinger added the comment: If this can only be triggered from C code, it less of a concern. The PR increases cost on a critical path, so we ought to be wary of applying it unless a known problem is being solved. Note, this code path has survived two decades of deployment. Also

[issue46610] assertCountEqual doesn't work as expected for dictionary elements

2022-02-02 Thread Raymond Hettinger
Raymond Hettinger added the comment: I agree with Eric that this should not be changed. It is working as documented and intended. In its original incarenation, assertCountEqual was documented as being equivalent to ``assertEqual(sorted(expected), sorted(actual))``. Either way, the goal

[issue46621] Should map(function, iterable, ...) replace StopIteration with RuntimeError?

2022-02-02 Thread Raymond Hettinger
Raymond Hettinger added the comment: -1 for being a breaking change, for addressing a minor issue that rarely arises in real life, and for being a slippery slope. -- nosy: +rhettinger ___ Python tracker <https://bugs.python.org/issue46

[issue46624] random.randrange removed support for non-integer types after just one release of deprecation

2022-02-03 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset 6baa98e538b2e26f16eaaf462f99496e98d2cfb1 by Miro Hrončok in branch 'main': bpo-46624: Defer to 3.12: "Remove deprecated support for non-integer values" (GH-31098) https://github.com/p

[issue46624] random.randrange removed support for non-integer types after just one release of deprecation

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

[issue46615] Use-after-free by mutating set during set operations

2022-02-03 Thread Raymond Hettinger
Raymond Hettinger added the comment: The likely culprit is the set_next() loop. Perhaps it is never safe to use set_next() because any lookup can callback to __eq__ which can mutate the set. Since set_isdisjoint() method isn't a mutating method, that is the easiest place to

[issue46615] Use-after-free by mutating set during set operations

2022-02-03 Thread Raymond Hettinger
Raymond Hettinger added the comment: Presumably _PyDict_Next is also suspect. Even the advertised "safe" calls to PyDict_SetItem() for existing keys would be a trigger. Calling clear() in either __eq__ or __hash__ would suffice. If the next loops are the culprint, the new ch

[issue46200] Discourage logging f-strings due to security considerations

2022-02-03 Thread Raymond Hettinger
Raymond Hettinger added the comment: > Eric is absolutely right, due to function calls being > somewhat slow in Python the performance argument in > practice falls in favor of f-strings. Also f-strings can evaluate expressions in the template which is also a big win: f('Pe

[issue46200] Discourage logging f-strings due to security considerations

2022-02-03 Thread Raymond Hettinger
Raymond Hettinger added the comment: In a favor of deferred substitution, the cookbook should have a recipe where substituted messages are logged to a file and the unsubstituted message stored in SQLite3 database with the parameters stored as JSON.This gives both human readable output

[issue46615] Use-after-free by mutating set during set operations

2022-02-03 Thread Raymond Hettinger
Raymond Hettinger added the comment: Marking as low priority given that ehe next loop code has been deployed without incident for two decades (a little less for sets and a little more for dicts). -- priority: normal -> low ___ Python trac

[issue46669] Add types.Self

2022-02-06 Thread Raymond Hettinger
New submission from Raymond Hettinger : Typeshed now has a nice self-describing type variable to annotate context managers: Self = TypeVar('Self') def __enter__(self: Self) -> Self: return self It would be nice to have that in the standard library types m

[issue46666] IDLE Add indent guide

2022-02-06 Thread Raymond Hettinger
Raymond Hettinger added the comment: If this were possible, it would be really nice to have. FWIW, the rich¹ project was able to pull this off in regular text terminal window: $ python3.10 -m pip install rich $ python3.10 -m rich.pretty { │ 'foo': [1, 'Hello World!

[issue46669] Add types.Self

2022-02-07 Thread Raymond Hettinger
Raymond Hettinger added the comment: On a related note, is this the correct way to annotate __exit__? Exc = TypeVar('Exc', bound=Exception) def __exit__(self, exctype: Optional[Type[Exc]], excinst: Optional[Exc], exctb: An

[issue46669] Add types.Self

2022-02-07 Thread Raymond Hettinger
Change by Raymond Hettinger : -- resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> Implementing PEP 673 (Self type) ___ Python tracker <https://bugs.python

[issue46282] return value of builtins is not clearly indicated

2022-02-07 Thread Raymond Hettinger
Raymond Hettinger added the comment: > New learners coming to Python don't know the same things > as people with experience. IMO, new learners will be worse off by adding "returns None" to all of the builtins. At best it a distractor. I work with new learners almost

[issue46669] Add types.Self

2022-02-07 Thread Raymond Hettinger
Raymond Hettinger added the comment: > Your suggested signature looks like it's trying to support > the second invariant, but it doesn't quite: if the types > don't match, the type checker will just set T to the > common base type of the two arguments. Is ther

[issue46684] Expose frozenset._hash classmethod

2022-02-08 Thread Raymond Hettinger
Raymond Hettinger added the comment: > Why not expose the C implementation via a frozenset._hash() > classmethod, and change Set._hash() to merely call that? The frozenset.__hash__ method is tightly bound to the internals of real sets to take advantage of the hash values already being

[issue46684] Expose frozenset._hash classmethod

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

[issue46705] Memory optimization for set.issubset

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

[issue46705] Memory optimization for set.issubset

2022-02-09 Thread Raymond Hettinger
Change by Raymond Hettinger : -- versions: -Python 3.10, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue46705> ___ ___ Pytho

[issue46705] Memory optimization for set.issubset

2022-02-09 Thread Raymond Hettinger
Raymond Hettinger added the comment: We care more about the running speed than the memory usage. Since sets only store pointers to data, they are typically smaller than the data they refer to. I've attached some instrumentation code for running experiments to verify the workload

[issue46705] Memory optimization for set.issubset

2022-02-09 Thread Raymond Hettinger
Raymond Hettinger added the comment: I've run a few more experiments and this looks like a net win more often than not. Go ahead and submit a PR so we can evaluate it further. -- Added file: https://bugs.python.org/file50614/instrument_issubs

[issue46705] Memory optimization for set.issubset

2022-02-09 Thread Raymond Hettinger
Change by Raymond Hettinger : Removed file: https://bugs.python.org/file50613/instrument_issubset.py ___ Python tracker <https://bugs.python.org/issue46705> ___ ___ Pytho

[issue46705] Memory optimization for set.issubset

2022-02-09 Thread Raymond Hettinger
Change by Raymond Hettinger : Removed file: https://bugs.python.org/file50614/instrument_issubset.py ___ Python tracker <https://bugs.python.org/issue46705> ___ ___ Pytho

[issue46705] Memory optimization for set.issubset

2022-02-09 Thread Raymond Hettinger
Change by Raymond Hettinger : Added file: https://bugs.python.org/file50615/instrument_issubset.py ___ Python tracker <https://bugs.python.org/issue46705> ___ ___ Pytho

[issue46705] Memory optimization for set.issubset

2022-02-10 Thread Raymond Hettinger
Raymond Hettinger added the comment: > Would not testing len(self.difference(other)) == 0 > be more efficient? Yes, I think so. -- Added file: https://bugs.python.org/file50620/instrument_issubset.py ___ Python tracker <https://bugs.p

[issue46718] Feature: itertools: add batches

2022-02-11 Thread Raymond Hettinger
Raymond Hettinger added the comment: For large n, I don't think a C implementation would do much better than your Python version where most of the work is done by chain() and islice() which are already in C. The best that could be done is to eliminate the overhead of chain() whi

[issue46721] Optimize set.issuperset() for non-set argument

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

[issue46713] Provide a C implementation of collections.abc.KeysView and friends

2022-02-11 Thread Raymond Hettinger
Raymond Hettinger added the comment: Some thoughts: * Other than set operations, most of the pure python code in the dict view ABCs are fast pass throughs. There is no point in rewriting these in C: def __contains__(self, key): return key in self._mapping def __iter__(self

[issue46713] Provide a C implementation of collections.abc.KeysView and friends

2022-02-11 Thread Raymond Hettinger
Raymond Hettinger added the comment: - arbitrary mappings supports by the view ABCs + arbitrary mappings supported by the view ABCs - A first look, + At first glance, -- ___ Python tracker <https://bugs.python.org/issue46

[issue46282] return value of builtins is not clearly indicated

2022-02-11 Thread Raymond Hettinger
Change by Raymond Hettinger : -- nosy: -rhettinger ___ Python tracker <https://bugs.python.org/issue46282> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue46728] Docstring of combinations_with_replacement for consistency

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

[issue46718] Feature: itertools: add batches

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

[issue46700] wrong nomenclature (options vs. arguments) in argparse

2022-02-12 Thread Raymond Hettinger
Raymond Hettinger added the comment: Éric is correct. There is not much that can be done about this. The nomenclature is deeply baked into the code and the docs. We did change the help output to list "options" rather than "optional arguments". That helps the end use

[issue46737] Default to the standard normal distribution

2022-02-13 Thread Raymond Hettinger
New submission from Raymond Hettinger : This is really minor, but it would convenient if we provided default arguments: random.gauss(mu=0.0, sigma=1.0) random.normalvariate(mu=0.0, sigma=1.0) -- components: Library (Lib) messages: 413177 nosy: rhettinger priority: normal

[issue45976] Random._randbelow() loses time by caching an attribute lookup

2022-02-13 Thread Raymond Hettinger
Raymond Hettinger added the comment: I'm thinking that we care more about the unhappy cases (the extreme values) than we care about a mild and implementation dependent improvement to the average case. -- resolution: later -> rejected __

[issue46737] Default to the standard normal distribution

2022-02-15 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset 08ec80113b3b7f7a9eaa3d217494536b63305181 by Zackery Spytz in branch 'main': bpo-46737: Add default arguments to random.gauss and normalvariate (GH-31360) https://github.com/python/cpython/commit/08ec80113b3b7f7a9eaa3d21749453

[issue46737] Default to the standard normal distribution

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

[issue46783] Add a new feature to enumerate(iterable, start=0) built-in function

2022-02-17 Thread Raymond Hettinger
Raymond Hettinger added the comment: Thank you for the suggestion, but we will decline. We looked at this before and decided not to go down this path, preferring instead to the keep the builtin function simple and focused on its core task of enumeration. To cover the rarer cases, it is a

[issue46764] Wrapping a bound method with a @classmethod no longer works

2022-02-17 Thread Raymond Hettinger
Raymond Hettinger added the comment: This seems like a reasonable fix. I'll wait a bit so that others can comment as well. FWIW, we looking a potentially reverting the whole line of development starting with that commit. It has caused a number of problems and no longer looks te

[issue45356] Calling `help` executes @classmethod @property decorated methods

2022-02-17 Thread Raymond Hettinger
Raymond Hettinger added the comment: See also: https://bugs.python.org/issue46764 -- ___ Python tracker <https://bugs.python.org/issue45356> ___ ___ Python-bug

[issue46780] Allow Fractions to return 1/6 for "0.17", "0.167", "0.1667", etc.

2022-02-17 Thread Raymond Hettinger
Raymond Hettinger added the comment: I don't think the standard library should go down this path. Mark's disinclinations all make sense to me, but I'm also concerned that the API would be almost unusable in practical situations. Users would tend to know their input fractio

[issue46780] Allow Fractions to return 1/6 for "0.17", "0.167", "0.1667", etc.

2022-02-17 Thread Raymond Hettinger
Raymond Hettinger added the comment: Also note for the music example that the notion of "near enough" isn't equidistant about the "simple fraction". The sense of nearness is logarithmic and is measured in "cents" which are hundredths of an equal-tempered s

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