Change by Raymond Hettinger :
--
title: string sorting often incorrect -> Clarify SortingHOWTO regarding locale
aware string sorting
versions: +Python 3.10, Python 3.11
___
Python tracker
<https://bugs.python.org/issu
Raymond Hettinger added the comment:
I don't think splashing this everywhere else in the docs would be helpful.
Tools like list.sort, sorted, min, max, nlargest, nsmallest use whatever sort
order is provided by the underlying object whether it be a string, tuple,
float, or int
Change by Raymond Hettinger :
--
nosy: +rhettinger
___
Python tracker
<https://bugs.python.org/issue47259>
___
___
Python-bugs-list mailing list
Unsubscribe:
Raymond Hettinger added the comment:
> isfinite() should return True for all ints, without needing
> to coerce them to float
Whoa there. You're venturing into changing what those math functions were all
about and the core approach to how they operate.
A zigzag to this new direction
Raymond Hettinger added the comment:
This is a partial duplicate of an issue you already filed:
https://bugs.python.org/issue47121 where math.isfinite(10**1000) raises an
OverflowError even though it type checks.
Here was one of the comments:
"""
Types relationships are usefu
Change by Raymond Hettinger :
--
assignee: -> rhettinger
___
Python tracker
<https://bugs.python.org/issue28540>
___
___
Python-bugs-list mailing list
Un
Raymond Hettinger added the comment:
One other thought. The mental model for degrees() is just a simple scaling
operation. If done in pure Python, we would get *inf* rather than an
OverflowError. I don't see any value in breaking with the obvious substitution:
>>> sys.float
Raymond Hettinger added the comment:
I'm not interested in having this move forward. AFAICT it doesn't solve any
known user problems (no one has cared about this before or since this issue was
opened). It slightly slows the code. And it might break some existing code
that wasn't
Raymond Hettinger added the comment:
Antoine, was the *callback* argument intended to be part of the public API?
--
nosy: +pitrou, rhettinger
___
Python tracker
<https://bugs.python.org/issue47
Raymond Hettinger added the comment:
See https://docs.python.org/3/tutorial/floatingpoint.html
--
nosy: +rhettinger
resolution: -> wont fix
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Raymond Hettinger added the comment:
> any objections before I propose the removal of one-argument super?
AFAICT there is nothing to be gained by deprecating the one argument form.
Because it has been stable API for two decades, removing it is guaranteed to
cause some disruption. So
Change by Raymond Hettinger :
--
resolution: -> not a bug
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Raymond Hettinger added the comment:
Marking as closed because the changes are incorrect. See the comments in the
PR.
--
assignee: -> rhettinger
nosy: +rhettinger
resolution: -> rejected
stage: -> resolved
status: open -> closed
__
Change by Raymond Hettinger :
--
resolution: -> fixed
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue47180>
___
___
Change by Raymond Hettinger :
--
versions: -Python 3.10, Python 3.9
___
Python tracker
<https://bugs.python.org/issue47180>
___
___
Python-bugs-list mailin
Raymond Hettinger added the comment:
This is indeed a duplicate. If needed just use one of implementations on PyPI
https://pypi.org/project/bidict/
--
nosy: +rhettinger
resolution: -> duplicate
stage: -> resolved
status: open -&g
Change by Raymond Hettinger :
--
nosy: +ncoghlan
___
Python tracker
<https://bugs.python.org/issue47135>
___
___
Python-bugs-list mailing list
Unsubscribe:
Raymond Hettinger added the comment:
I think this may fine as-is. In general, virtiual classes only promise that an
operation will work rather than promsing the presence of a particular method.
An object can be Iterable without defining __iter__ because iter() can use
__getitem__
Raymond Hettinger added the comment:
Will leave this open for a few days to see if anyone else steps forward to make
a case for or against this proposal.
--
assignee: -> rhettinger
versions: -Python 3.10, Python 3.9
___
Python tracker
<
Raymond Hettinger added the comment:
Guido, what do you think about this proposal?
Personally, I'm dubious about changing the meaning of the arguments between
code paths. The callee has no way to distinguish which meaning was intended.
And adding classmethod() support in super_descr_get
Change by Raymond Hettinger :
--
assignee: docs@python -> rhettinger
nosy: +rhettinger
___
Python tracker
<https://bugs.python.org/issue47122>
___
___
Python-
Raymond Hettinger added the comment:
The math.isfinite() docs could be changed to something like, "coerces x to a
float if possible and then returns True if x is neither an infinity nor a NaN,
and False otherwise." Or there could be a general note about which functions
(mo
Change by Raymond Hettinger :
--
assignee: -> rhettinger
___
Python tracker
<https://bugs.python.org/issue47114>
___
___
Python-bugs-list mailing list
Un
Raymond Hettinger added the comment:
This was an intentional decision. It is documented and tested. The rationale
is that is keeps choices() internally consistent so that choices with equal
weights produces the same result as if no weights are specified.
For anyone who wants
Change by Raymond Hettinger :
--
resolution: -> rejected
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Raymond Hettinger added the comment:
This was fixed in commit 62fa613f6a6e872723505ee9d56242c31a654a9d
--
nosy: +rhettinger
resolution: -> out of date
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bug
Change by Raymond Hettinger :
--
assignee: effbot ->
___
Python tracker
<https://bugs.python.org/issue433030>
___
___
Python-bugs-list mailing list
Unsubscrib
Raymond Hettinger added the comment:
There seem to be a number of escaping problems in the OP's example.
Is this what was intended?
>>> re.sub(r"\{(\w+)\}", r"\1", "Hello! {user}")
'Hello! user'
--
no
Change by Raymond Hettinger :
--
nosy: +rhettinger
___
Python tracker
<https://bugs.python.org/issue47007>
___
___
Python-bugs-list mailing list
Unsubscribe:
Raymond Hettinger added the comment:
The code in the screenshot looks correct.
>>> i = 0
>>> i is int
False
>>> type(i) is int
True
The code above does not get warning because "int" is a variable. This kind of
comparison is always allowed and
Raymond Hettinger added the comment:
Related issue: https://bugs.python.org/issue43923
--
nosy: +rhettinger
___
Python tracker
<https://bugs.python.org/issue44
Raymond Hettinger added the comment:
The weakref docs in particular should point out the OP's example and highlight
the workaround.
--
___
Python tracker
<https://bugs.python.org/issue46
Raymond Hettinger added the comment:
I concur with Jelle and Methane that we can't do this without breaking code.
Also if you don't care about dict order, the work around is easy. Just remove
the old key:
d.pop(k); d[k] = v
--
nosy: +rhettinger
resolution: -> rejected
st
Raymond Hettinger added the comment:
The difference is the FLAG_REF which is set to 128 (0x80).
>>> import marshal
>>> var_example = [(1,2,3),(4,5,6)]
>>> vm = marshal.dumps(var_example)
>>> rm = marshal.dumps([(1,2,3),(4,5,6)])
>>> [v ^ r for v,
Raymond Hettinger added the comment:
> I think this is more confusing then helpful.
I concur.
--
___
Python tracker
<https://bugs.python.org/issu
Raymond Hettinger added the comment:
I would not miss these methods. Unless Mark says they are needed, +1 for
removal.
--
nosy: +mark.dickinson, rhettinger, tim.peters
___
Python tracker
<https://bugs.python.org/issue46
Raymond Hettinger added the comment:
[Andrew Svetlov]
> A third-party library should either copy all these
> implementation details or import a private function from stdlib
OrderedDict provides just about everything needed to roll lru cache variants.
It simply isn't true this ca
Raymond Hettinger added the comment:
I'm going to close this one. Making a new and previously rejected extension to
one of Python's most import APIs requires broad discussion and buy-in. If you
really want to push for this, please take it to the python-ideas list.
--
resolution
Change by Raymond Hettinger :
--
title: Add a async variant of lru_cache for coroutines. -> Add an async variant
of lru_cache for coroutines.
___
Python tracker
<https://bugs.python.org/issu
Raymond Hettinger added the comment:
If this goes forward, my strong preference is to have a separate async_lru()
function just like the referenced external project.
For non-async uses, overloading the current lru_cache makes it confusing to
reason about. It becomes harder to describe
Raymond Hettinger added the comment:
I'll add a note that the output type is determined by the input type.
--
assignee: docs@python -> rhettinger
nosy: +rhettinger
priority: normal -> low
___
Python tracker
<https://bugs.python.org/i
Raymond Hettinger added the comment:
Note that adding an empty __post_init__ method would be a breaking change. The
following prints out 'B' then 'C'. But if class A adds an empty __post_init__,
then 'B' never gets printed. The arrangement relies on class A being a
passthrough to class B
Raymond Hettinger added the comment:
FWIW, I’m only -0 on this. It is also perfectly reasonable to say that a
class is abstract if and only if there is at least one remaining abstract
method. After 15 years though, I’m inclined to say that the status quo wins
Raymond Hettinger added the comment:
An analogy may help. Release managers must check the list of release blockers
and stop if the list is non-empty. If no release blockers were ever filed, the
release blockers list is empty, but it still exists and its definition hasn't
changed
Raymond Hettinger added the comment:
To me, this looks like a way too extensive edit jsut to emphasize a corner case
that rarely arises in practice. It bends over backwards to force an awkward
definition regarding what an ABC really is.
A more minimal edit is to just note
Raymond Hettinger added the comment:
This idea surfaced once before and Guido shot it down. IIRC the rationale was
the exposed implementation details, that would challenging for users to
consistently set the size correctly, and that it may not make sense for other
implementations
Change by Raymond Hettinger :
--
nosy: +tim.peters
___
Python tracker
<https://bugs.python.org/issue46812>
___
___
Python-bugs-list mailing list
Unsubscribe:
Raymond Hettinger added the comment:
-1
* I concur with Eric that this is mostly not needed. Probably 99.95% of
dataclass use case don't need this. When it is needed, it is trivial to
implement and probably should be explicit rather that implicit.
* Vedran is also correct in noting
Raymond Hettinger added the comment:
> Nor will it achieve world peace.
Please watch the tone. It is borderline abusive and dismissive.
> we can invoke the attached as best_fraction(Fraction("0.001"),
> Fraction("0.0005"), Fraction("0.0015")) to get t
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 semito
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 fraction
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:
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
tenable
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
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 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/08ec80113b3b7f7a9eaa3d217494536b63305181
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
___
Pyt
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:
É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
Change by Raymond Hettinger :
--
resolution: -> rejected
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Raymond Hettinger :
--
assignee: -> rhettinger
nosy: +rhettinger
___
Python tracker
<https://bugs.python.org/issue46728>
___
___
Python-bugs-lis
Change by Raymond Hettinger :
--
nosy: -rhettinger
___
Python tracker
<https://bugs.python.org/issue46282>
___
___
Python-bugs-list mailing list
Unsubscribe:
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
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
Change by Raymond Hettinger :
--
assignee: -> rhettinger
___
Python tracker
<https://bugs.python.org/issue46721>
___
___
Python-bugs-list mailing list
Un
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() which
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
Change by Raymond Hettinger :
Added file: https://bugs.python.org/file50615/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 :
Removed file: https://bugs.python.org/file50613/instrument_issubset.py
___
Python tracker
<https://bugs.python.org/issue46705>
___
___
Pytho
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_issubset.py
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 under
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
Change by Raymond Hettinger :
--
assignee: -> rhettinger
___
Python tracker
<https://bugs.python.org/issue46705>
___
___
Python-bugs-list mailing list
Un
Change by Raymond Hettinger :
--
assignee: -> rhettinger
___
Python tracker
<https://bugs.python.org/issue46684>
___
___
Python-bugs-list mailing list
Un
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
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 there a way to writ
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 every
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:
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:
Any) -> N
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!', 100.123, 323.232
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 module as w
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
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:
> 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('Pending
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
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 start
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 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/python/cpyt
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:
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:
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 concur with Serhiy.
--
nosy: +pitrou, rhettinger
___
Python tracker
<https://bugs.python.org/issue46554>
___
___
Pytho
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, the code for `count
Change by Raymond Hettinger :
--
status: closed -> open
___
Python tracker
<https://bugs.python.org/issue33205>
___
___
Python-bugs-list mailing list
Un
Change by Raymond Hettinger :
--
nosy: +rhettinger
___
Python tracker
<https://bugs.python.org/issue46527>
___
___
Python-bugs-list mailing list
Unsubscribe:
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 :
--
resolution: -> not a bug
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Raymond Hettinger added the comment:
> But I won't post code (unless someone asks)
Okay, I'll ask.
--
___
Python tracker
<https://bugs.python.org/issu
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 two
1 - 100 of 9507 matches
Mail list logo