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
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
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
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
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
Change by Raymond Hettinger :
--
nosy: +barry
___
Python tracker
<https://bugs.python.org/issue46307>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Raymond Hettinger :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
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
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
Change by Raymond Hettinger :
--
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue46270>
___
___
Pyth
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
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
Change by Raymond Hettinger :
--
nosy: +rhettinger
___
Python tracker
<https://bugs.python.org/issue46334>
___
___
Python-bugs-list mailing list
Unsubscribe:
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),
Change by Raymond Hettinger :
Removed file: https://bugs.python.org/file50555/comb_pole.py
___
Python tracker
<https://bugs.python.org/issue37295>
___
___
Python-bug
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
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
Change by Raymond Hettinger :
Removed file: https://bugs.python.org/file50556/comb_pole.py
___
Python tracker
<https://bugs.python.org/issue37295>
___
___
Python-bug
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
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
Change by Raymond Hettinger :
--
nosy: +rhettinger
___
Python tracker
<https://bugs.python.org/issue46361>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Raymond Hettinger :
--
Removed message: https://bugs.python.org/msg410440
___
Python tracker
<https://bugs.python.org/issue37295>
___
___
Python-bug
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
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.&
Change by Raymond Hettinger :
Added file: https://bugs.python.org/file50559/comb_pole2.py
___
Python tracker
<https://bugs.python.org/issue37295>
___
___
Python-bug
Change by Raymond Hettinger :
--
assignee: -> rhettinger
nosy: +rhettinger
___
Python tracker
<https://bugs.python.org/issue46380>
___
___
Python-bugs-lis
Change by Raymond Hettinger :
--
assignee: docs@python -> rhettinger
___
Python tracker
<https://bugs.python.org/issue46379>
___
___
Python-bugs-list mai
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
Raymond Hettinger added the comment:
Please do keep looking for improvements. Suggestions are always welcome.
--
___
Python tracker
<https://bugs.python.org/issue46
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
Change by Raymond Hettinger :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
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
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
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
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
Change by Raymond Hettinger :
--
assignee: rhettinger ->
___
Python tracker
<https://bugs.python.org/issue46376>
___
___
Python-bugs-list mailing list
Un
Change by Raymond Hettinger :
--
assignee: -> rhettinger
___
Python tracker
<https://bugs.python.org/issue46388>
___
___
Python-bugs-list mailing list
Un
Change by Raymond Hettinger :
--
nosy: +vstinner
___
Python tracker
<https://bugs.python.org/issue46372>
___
___
Python-bugs-list mailing list
Unsubscribe:
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
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:
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
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
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
Change by Raymond Hettinger :
--
nosy: +rhettinger, tim.peters
___
Python tracker
<https://bugs.python.org/issue46406>
___
___
Python-bugs-list mailing list
Unsub
Change by Raymond Hettinger :
--
pull_requests: +28857
pull_request: https://github.com/python/cpython/pull/30656
___
Python tracker
<https://bugs.python.org/issue42
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
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
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
-
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
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
Raymond Hettinger added the comment:
> But I won't post code (unless someone asks)
Okay, I'll ask.
--
___
Python tracker
<https://bugs.pytho
Change by Raymond Hettinger :
--
resolution: -> not a bug
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
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.
--
__
Change by Raymond Hettinger :
--
nosy: +rhettinger
___
Python tracker
<https://bugs.python.org/issue46527>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Raymond Hettinger :
--
status: closed -> open
___
Python tracker
<https://bugs.python.org/issue33205>
___
___
Python-bugs-list mailing list
Un
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
Raymond Hettinger added the comment:
I concur with Serhiy.
--
nosy: +pitrou, rhettinger
___
Python tracker
<https://bugs.python.org/issue46554>
___
___
Pytho
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
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
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
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
Change by Raymond Hettinger :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
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
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
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
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
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
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
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!
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
Change by Raymond Hettinger :
--
resolution: -> duplicate
stage: -> resolved
status: open -> closed
superseder: -> Implementing PEP 673 (Self type)
___
Python tracker
<https://bugs.python
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
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
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
Change by Raymond Hettinger :
--
assignee: -> rhettinger
___
Python tracker
<https://bugs.python.org/issue46684>
___
___
Python-bugs-list mailing list
Un
Change by Raymond Hettinger :
--
assignee: -> rhettinger
___
Python tracker
<https://bugs.python.org/issue46705>
___
___
Python-bugs-list mailing list
Un
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
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
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
Change by Raymond Hettinger :
Removed file: https://bugs.python.org/file50613/instrument_issubset.py
___
Python tracker
<https://bugs.python.org/issue46705>
___
___
Pytho
Change by Raymond Hettinger :
Removed file: https://bugs.python.org/file50614/instrument_issubset.py
___
Python tracker
<https://bugs.python.org/issue46705>
___
___
Pytho
Change by Raymond Hettinger :
Added file: https://bugs.python.org/file50615/instrument_issubset.py
___
Python tracker
<https://bugs.python.org/issue46705>
___
___
Pytho
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
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
Change by Raymond Hettinger :
--
assignee: -> rhettinger
___
Python tracker
<https://bugs.python.org/issue46721>
___
___
Python-bugs-list mailing list
Un
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
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
Change by Raymond Hettinger :
--
nosy: -rhettinger
___
Python tracker
<https://bugs.python.org/issue46282>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Raymond Hettinger :
--
assignee: -> rhettinger
nosy: +rhettinger
___
Python tracker
<https://bugs.python.org/issue46728>
___
___
Python-bugs-lis
Change by Raymond Hettinger :
--
resolution: -> rejected
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
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
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
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
__
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
Change by Raymond Hettinger :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
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
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
Raymond Hettinger added the comment:
See also: https://bugs.python.org/issue46764
--
___
Python tracker
<https://bugs.python.org/issue45356>
___
___
Python-bug
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
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
101 - 200 of 9609 matches
Mail list logo