New submission from Dennis Sweeney :
The following tiny change:
diff --git a/Objects/listobject.c b/Objects/listobject.c
index 3c39c6444b..3ac03b71d0 100644
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -2643,8 +2643,7 @@ list_richcompare(PyObject *v, PyObject *w, int op
New submission from Dennis Sweeney :
Should something like the following go in the standard library, most likely in
the math module? I know I had to use such a thing before pow(a, -1, b) worked,
but Bezout is more general. And many of the easy stackoverflow implementations
of CRT congruence
Dennis Sweeney added the comment:
Correction correction: returning zero preserves the invariant below.
from math import gcd as GCD
from functools import reduce
from itertools import starmap, chain
def gcd(*args):
return reduce(GCD, args, 0)
iterables = [[10, 20, 30
Dennis Sweeney added the comment:
Correction: gcd(itertools.chain(iterables)) == gcd(*map(gcd, iterables))
--
___
Python tracker
<https://bugs.python.org/issue39
Dennis Sweeney added the comment:
I think the behavior of gcd() == 0 is correct, but it should be documented,
because it isn't completely obvious.
Arguments for gcd() == 0:
- Preserves the invariant gcd(itertools.chain(iterables)) ==
gcd(itertools.starmap(gcd, iterables)) in the case
Change by Dennis Sweeney :
--
pull_requests: +17803
pull_request: https://github.com/python/cpython/pull/18427
___
Python tracker
<https://bugs.python.org/issue38
Dennis Sweeney added the comment:
Should there be a similar generic test case in test.seq_test?
--
___
Python tracker
<https://bugs.python.org/issue39
Change by Dennis Sweeney :
--
keywords: +patch
pull_requests: +17796
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/18421
___
Python tracker
<https://bugs.python.org/issu
New submission from Dennis Sweeney :
Similar to https://bugs.python.org/issue39453, but with deques:
Python 3.9.0a3+:
>>> from collections import deque
>>> class A:
... def __eq__(self, other):
... L.clear()
... return NotImplemented
...
>>> L =
Dennis Sweeney added the comment:
PR 17729 is a C implementation of a non-recursive "flattening" of the the
recursive-lazy-mergesort algorithm into a tournament whose state is a tree of
losers of comparisons.
--
___
Python track
Change by Dennis Sweeney :
--
pull_requests: +17174
pull_request: https://github.com/python/cpython/pull/17729
___
Python tracker
<https://bugs.python.org/issue38
Change by Dennis Sweeney :
--
keywords: +patch
pull_requests: +16903
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/17422
___
Python tracker
<https://bugs.python.org/issu
Dennis Sweeney added the comment:
Disregard merge_recipe.py: it would skip over a value that had already been
retrieved from the iterator when the loop finished.
--
___
Python tracker
<https://bugs.python.org/issue38
Dennis Sweeney added the comment:
The following seems like it is a short, readable recipe for itertools.
--
Added file: https://bugs.python.org/file48748/merge_recipe.py
___
Python tracker
<https://bugs.python.org/issue38
New submission from Dennis Sweeney :
Although the implementation of the heapq.merge function uses an underlying heap
structure, its behavior centers on iterators. For this reason, I believe there
should either be an alias to this function in the itertools module or at least
a recipe
New submission from Dennis Sweeney :
I understand that the SequenceMatcher's ratio method does not guarantee that
SequenceMatcher(None, a, b).ratio() == SequenceMatcher(None, b, a).ratio().
Below is a counterexample:
# Example from
https://mail.python.org/pipermail/python-list/2010
501 - 516 of 516 matches
Mail list logo