Raymond Hettinger added the comment:
Changing sniffer logic is risky because it risks breaking existing code that
relies on the current predictions.
FWIW, in your example, the sniffer gets the desired result if given a delimiter
hint:
>>> s = "a|b\nc| 'd\ne|' f&
Raymond Hettinger added the comment:
New changeset 4194f1465fa85371dcbead57a54bb06d1f0b97d9 by Miss Islington (bot)
in branch '3.10':
bpo-44704: Make Set._hash consistent with frozenset.__hash__ (GH-27281)
(GH-27282)
https://github.com/python/cpyt
Raymond Hettinger added the comment:
New changeset e0ef81600f4331299f61bbe3f7f08bb21d90315b by Miss Islington (bot)
in branch '3.9':
bpo-44704: Make Set._hash consistent with frozenset.__hash__ (GH-27281)
(GH-27283)
https://github.com/python/cpyt
Change by Raymond Hettinger :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Raymond Hettinger :
--
nosy: +tim.peters
___
Python tracker
<https://bugs.python.org/issue44698>
___
___
Python-bugs-list mailing list
Unsubscribe:
Raymond Hettinger added the comment:
New changeset c878f5d81772dc6f718d6608c78baa4be9a4f176 by Dennis Sweeney in
branch 'main':
bpo-44704: Make Set._hash consistent with frozenset.__hash__ (GH-27281)
https://github.com/python/cpython/commit/c878f5d81772dc6f718d6608c78baa
Change by Raymond Hettinger :
--
nosy: +mark.dickinson
___
Python tracker
<https://bugs.python.org/issue44698>
___
___
Python-bugs-list mailing list
Unsubscribe:
Raymond Hettinger added the comment:
Returning the same object is just a micro-optimization and we've decided that
it isn't worth it. In bpo-40521, frozenset() stop being a singleton. This
costs a small bit of space but saves code complexity and a bit of execution
time (especi
Change by Raymond Hettinger :
--
versions: -Python 3.10, Python 3.7, Python 3.8, Python 3.9
___
Python tracker
<https://bugs.python.org/issue44605>
___
___
Pytho
Change by Raymond Hettinger :
--
assignee: -> rhettinger
nosy: +rhettinger
___
Python tracker
<https://bugs.python.org/issue44605>
___
___
Python-bugs-lis
Change by Raymond Hettinger :
--
resolution: -> not a bug
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue44573>
___
___
Pyth
Raymond Hettinger added the comment:
> For convenience, the takewhile iterator can also have
> additional attributes: a boolean attribute which indicates
> that the falsifying element is set, and dynamic attribute
> which is equal to orig_iterator
> or chain([odd_element]
Raymond Hettinger added the comment:
I've done some API experiments using a data munging example. See attached file.
The proposed API for takewhile() to save the last attribute is somewhat awkward
to use:
it = iter(report)
tw_it = takewhile(is_header, it)
for line in take
Raymond Hettinger added the comment:
Thanks for the suggestion, but only the minheap functions are public. The
maxheap functions are private, for internal use only. Currently, there is no
internal need for a maxheap push.
--
resolution: -> rejected
stage: patch review -> re
Raymond Hettinger added the comment:
In practice, this hasn't been an issue. I recommend leaving it alone. Adding
more directories is also a nuisance and doesn't really make anyone's life
better.
--
nosy: +rhettinger
___
Python
Raymond Hettinger added the comment:
At worst, this seems like only a minor nuisance. The ABC metaclass is limited
in its powers and seems to reasonably cover the common use cases.
I recommend leaving it as is. Guido, what do you think?
--
assignee: -> gvanrossum
n
Raymond Hettinger added the comment:
I'm closing this as not being worth changing. It is only a minor irritant and
arguably not a bug. "Fixing it" would be disruptive and likely not help anyone.
--
resolution: -> wont fix
stage: -> resolved
s
Raymond Hettinger added the comment:
The remaining unicode_eq can be left as-is. While it is only in dictobject.c,
the requisite knowledge of string internals makes it reasonable to keep it in
stringlib.
--
resolution: -> fixed
stage: needs patch -> resolved
status
Raymond Hettinger added the comment:
> What if set the last item as an attribute of the takewhile iterator?
Perhaps raise an attribute error unless the falsifying element is set?
--
___
Python tracker
<https://bugs.python.org/issu
Change by Raymond Hettinger :
--
components: +Library (Lib)
versions: +Python 3.11
___
Python tracker
<https://bugs.python.org/issue44571>
___
___
Python-bug
Raymond Hettinger added the comment:
Thanks for the suggestion. I agree that the loss of the non-matching element
is an irritant. The suggestion to return the first false element would solve
that problem but is itself hard to work with. The result would be difficult to
reason about
Raymond Hettinger added the comment:
> I am wondering whether one of __int__ or __trunc__ should be deprecated.
I would not miss __trunc__.
--
nosy: +rhettinger
___
Python tracker
<https://bugs.python.org/issu
Change by Raymond Hettinger :
--
nosy: +rhettinger
___
Python tracker
<https://bugs.python.org/issue44558>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Raymond Hettinger :
--
components: +Library (Lib)
title: StopIteration subclass raised in body of 'with' statement suppressed ->
StopIteration subclass suppressed by contextlib.contextmanager
type: -> behavior
versions: -Python 3.6, Python
Change by Raymond Hettinger :
--
nosy: +rhettinger
___
Python tracker
<https://bugs.python.org/issue44566>
___
___
Python-bugs-list mailing list
Unsubscribe:
Raymond Hettinger added the comment:
> I still disagree with this design since it's not
> how a person using a hash map expects it to behave.
All mapping data structures have tradeoffs. For the core dict type, we chose a
structure that benefits most Python users most of the time.
Raymond Hettinger added the comment:
Pablo, I'm having second thoughts on hash forwarding. It looks like its
omission was an intentional design decision. I vote for restoring the previous
behavior. That will likely save some headaches for some users.
--
nosy: +rhett
Change by Raymond Hettinger :
--
assignee: docs@python -> pablogsal
nosy: +pablogsal
___
Python tracker
<https://bugs.python.org/issue44523>
___
___
Python-
Raymond Hettinger added the comment:
Thanks for the suggestion but we've not adopted type annotations in the
documentation.
--
nosy: +rhettinger
resolution: -> rejected
stage: -> resolved
status: open -> closed
___
Python t
Raymond Hettinger added the comment:
Marking as closed for the reasons listed in the PR comments.
--
nosy: +rhettinger
resolution: -> rejected
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bug
Raymond Hettinger added the comment:
Adding a weak referencing recipe here just so I can find it in the future.
--
import functools
import weakref
def weak_lru(maxsize=128, typed=False):
"""LRU Cache
Change by Raymond Hettinger :
--
pull_requests: +25373
pull_request: https://github.com/python/cpython/pull/26789
___
Python tracker
<https://bugs.python.org/issue44
Raymond Hettinger added the comment:
New changeset 77eaf14d278882857e658f83681e5b9a52cf14ac by Miss Islington (bot)
in branch '3.10':
bpo-44310: Add a FAQ entry for caching method calls (GH-26731) (GH-26777)
https://github.com/python/cpython/commit/77eaf14d278882857e658f83681e5b
Raymond Hettinger added the comment:
New changeset 7f01f77f8fabcfd7ddb5d99f12d6fc99af9af384 by Raymond Hettinger in
branch 'main':
bpo-44310: Add a FAQ entry for caching method calls (GH-26731)
https://github.com/python/cpython/commit/7f01f77f8fabcfd7ddb5d99f12d6fc
Raymond Hettinger added the comment:
> I meant, if one has set maxsize=None.
The docs already say, "If maxsize is set to None, the LRU feature is disabled
and the cache can grow without bound."
--
___
Python tracker
<https:/
Raymond Hettinger added the comment:
> if you are creating instances and calling this method
> all the time, will lead to an infinite memory leak.
Your words aren't making any sense to me. The default
lru_cache will never hold more than maxsize entries.
The default maxsize is 1
Raymond Hettinger added the comment:
If you read the text afterwards, you'll see that raising a TypeError was the
intended purpose of this example. Just afterward, it shows how to use *type*
to make the code correct.
--
assignee: -> rhettinger
nosy: +rhettinger
resolution:
New submission from Raymond Hettinger :
Marking as closed for the reasons mentioned in the PR. I you want to go
forward, consider starting a thread on python-ideas.
--
nosy: +rhettinger
resolution: -> rejected
stage: patch review -> resolved
status: open -&g
Raymond Hettinger added the comment:
The problem is still present in Python 3.10b2.
--
title: Broad performance regression from 3.10a7 to 3.10b1 with python.org macOS
binaries -> Broad performance regression from 3.10a7 to 3.10b2 with python.org
macOS binar
Raymond Hettinger added the comment:
See PR 26731 for a draft FAQ entry. Let me know what you think.
--
___
Python tracker
<https://bugs.python.org/issue44
Change by Raymond Hettinger :
--
pull_requests: +25319
pull_request: https://github.com/python/cpython/pull/26731
___
Python tracker
<https://bugs.python.org/issue44
Raymond Hettinger added the comment:
[Victor Stinner]
> My plan is to merge changes which have no significant
> impact on performances
FWIW, PyFloat_FromDouble() is the most performance critical function in
floatobject.c.
--
___
Python t
Change by Raymond Hettinger :
--
assignee: -> vinay.sajip
nosy: +vinay.sajip
___
Python tracker
<https://bugs.python.org/issue37880>
___
___
Python-bugs-lis
Change by Raymond Hettinger :
--
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue44421>
___
___
Python-bugs-
Raymond Hettinger added the comment:
I concur with Jack. There is no evidence of a bug in Python itself and it is
not reasonable to ask us the study and debug your obfuscated code.
I just ran random.uniform() in a tight loop for several minutes and observed no
deleterious effects. Am
Raymond Hettinger added the comment:
New changeset 809c3faa032d32bc45a0fa54d0400fcbc42a618f by Miss Islington (bot)
in branch '3.10':
bpo-44310: Note that lru_cache keep references to both arguments and results
(GH-26715) (GH-26716)
https://github.com/python/cpyt
Change by Raymond Hettinger :
--
resolution: duplicate -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Raymond Hettinger added the comment:
New changeset fafcfff9262ae9dee03a6638dfcbcfc23a7b by Raymond Hettinger in
branch 'main':
bpo-44310: Note that lru_cache keep references to both arguments and results
(GH-26715)
https://github.com/python/cpyt
Change by Raymond Hettinger :
--
pull_requests: +25303
pull_request: https://github.com/python/cpython/pull/26715
___
Python tracker
<https://bugs.python.org/issue44
Raymond Hettinger added the comment:
> If one wants to have all NaNs in one equivalency class
> (e.g. if used as a key-value for example in pandas) it
> is almost impossible to do so in a consistent way
> without taking a performance hit.
ISTM the performance of the equivalent c
Raymond Hettinger added the comment:
> How common match-case statements with literal integers?
Nothing is common yet because the feature hasn't been released ;-)
I suspect that if match-case were optimized for integer constants, they would
be used. In discussions about case st
Raymond Hettinger added the comment:
> Maybe add two key functions for making NaN either the smallest
> or the largest number?
SQL does this with NULLS FIRST or NULLS LAST but it is a nuisance. I think it
better to opt for simplicity and choose a d
Raymond Hettinger added the comment:
> There's also a somewhat arbitrary choice to be made here:
> do we consider NaNs to be negative or positive?
> That is, do we want NaNs to sort to the beginning of the
> list, or the end?
I had suggested putting NaNs at the beginnin
Change by Raymond Hettinger :
--
assignee: docs@python -> vinay.sajip
nosy: +vinay.sajip
___
Python tracker
<https://bugs.python.org/issue44399>
___
___
Py
Raymond Hettinger added the comment:
> I would like to get opinions from Raymond and then
> proceed with this issue.
I concur with Steven and Serhiy and don't think this should be added.
--
resolution: -> rejected
stage: -> resolved
statu
Raymond Hettinger added the comment:
We should consider biting the bullet and revising the default NaN sort order.
It has been a perpetual irritant.
1) Have NaNs always compare to less than any other float value.
2) When comparing two distinct NaNs, use the NaN payload
and fall back to
Raymond Hettinger added the comment:
Given how long this object has been its current state, the OP's request seems
reasonable to me and it is an easy change to make. I don't think there is any
downside. Also, if this ever becomes a builtin, I think we would leave th
Raymond Hettinger added the comment:
+1 from me as well.
--
nosy: +rhettinger
___
Python tracker
<https://bugs.python.org/issue44339>
___
___
Python-bugs-list m
Raymond Hettinger added the comment:
New changeset b5cedd098043dc58ecf9c2f33774cd7646506a92 by Miss Islington (bot)
in branch '3.10':
bpo-44227: Update bisect docstrings (GH-26548) (GH-26563)
https://github.com/python/cpython/commit/b5cedd098043dc58ecf9c2f33774cd
Change by Raymond Hettinger :
--
assignee: -> vinay.sajip
nosy: +vinay.sajip
___
Python tracker
<https://bugs.python.org/issue44186>
___
___
Python-bugs-lis
Raymond Hettinger added the comment:
It may useful to link back to @cached_property() for folks wanting method
caching tied to the lifespan of an instance rather than actual LRU logic.
--
___
Python tracker
<https://bugs.python.org/issue44
Raymond Hettinger added the comment:
I'm thinking of a more minimal and targeted edit than what is in the PR.
Per the dev guide, we usually word the docs in an affirmative and specific
manner (here is what the tool does and an example of how to use it).
Recounting a specific debu
Raymond Hettinger added the comment:
Also note that many important objects in Python are not weak referenceable,
tuples for example.
--
title: lru_cache memory leak -> Document that lru_cache uses hard references
___
Python tracker
<
Change by Raymond Hettinger :
--
assignee: -> rhettinger
___
Python tracker
<https://bugs.python.org/issue44310>
___
___
Python-bugs-list mailing list
Un
Raymond Hettinger added the comment:
FWIW, namedtuple speed improved considerably since these posts were made. When
I last checked, their lookup speed was about the same as a dict lookup.
See: https://docs.python.org/3/whatsnew/3.9.html#optimizations
Raymond Hettinger added the comment:
> The unknown is whether anyone has changed these
> pseudoevent bindings and if so, how much do we care?
I don't think we care. Getting tab completion sorted out is the priority.
--
nosy:
Raymond Hettinger added the comment:
Lists appends and pops are already amortized O(1) operations. As they grow,
they over-allocate by 12.5%. When shrinking they reclaim memory when the size
falls in half. Together, these two strategies make lists efficient as a LIFO
stack.
A straight
Raymond Hettinger added the comment:
I think the old wording was better. Code can explicitly raise an exception,
but other exceptions just occur when calling builtin functions or with a
keyboard interrupt.
--
nosy: +eric.smith, rhettinger
Raymond Hettinger added the comment:
In difflib, there's an example where it would be easy to run performance tests.
match tag:
case 'replace':
g = self._fancy_replace(a, alo, ahi, b, blo, bhi)
Raymond Hettinger added the comment:
ISTM that the table order doesn't need to match because the links take you
directly to the section of interest. They make it so that you don't need to
know the order of sections below. Currently, they have a "logical" grouping
w
Raymond Hettinger added the comment:
If the json.encoder code does get updated, it doesn't need two levels of
matching. It can be flattened by eliminating the *chunks* variable.
match value:
case str():
yield _encoder(value)
case None:
yield
Change by Raymond Hettinger :
--
assignee: docs@python -> rhettinger
nosy: +rhettinger
versions: -Python 3.9
___
Python tracker
<https://bugs.python.org/issu
Change by Raymond Hettinger :
--
priority: normal -> low
___
Python tracker
<https://bugs.python.org/issue44281>
___
___
Python-bugs-list mailing list
Un
Raymond Hettinger added the comment:
Big +1 from me. This would make use of match-case more compelling.
--
nosy: +rhettinger
___
Python tracker
<https://bugs.python.org/issue44
Raymond Hettinger added the comment:
> Conceptually, yes, but the function does return an index,
The function does not return an index. It returns an integer that represents
an insertion point. The documentation is clear about this:
Locate the insertion point for x in a to maint
Raymond Hettinger added the comment:
> I can add getLevelNamesDict() which would return a copy of _nameToLevel
That seem like the best approach.
--
assignee: -> vinay.sajip
nosy: +rhettinger
___
Python tracker
<https://bugs.python.org/i
Raymond Hettinger added the comment:
Consider moving seeding from _random.Random.__new__ to _random.Random.__init__.
Since random.Random.__init__ doesn't call the super(), the C version never
gets called, avoiding the double seeding. But, it still lets _random.Random
function
Change by Raymond Hettinger :
--
stage: -> resolved
status: pending -> closed
___
Python tracker
<https://bugs.python.org/issue32915>
___
___
Python-bugs-
Change by Raymond Hettinger :
--
Removed message: https://bugs.python.org/msg394414
___
Python tracker
<https://bugs.python.org/issue37596>
___
___
Python-bug
Raymond Hettinger added the comment:
Is it possible to defer hash randomization until after pycs are generated? The
underlying problem here is an intentional scrambling of data. If determinism
is what is desired then deferring that action addresses the action cause of
non-determinism
Raymond Hettinger added the comment:
William, thank you for the suggestion, but we're going to decline for the
reasons listed by Eric and me.
--
resolution: -> rejected
stage: patch review -> resolved
status: open -> closed
___
Raymond Hettinger added the comment:
New changeset a6825197e9f2bd730d8da38f223608411e508695 by Miss Islington (bot)
in branch '3.10':
bpo-44151: Various grammar, word order, and markup fixes (GH-26344) (GH-26345)
https://github.com/python/cpyt
Change by Raymond Hettinger :
--
pull_requests: +24936
pull_request: https://github.com/python/cpython/pull/26344
___
Python tracker
<https://bugs.python.org/issue44
Change by Raymond Hettinger :
--
resolution: -> not a bug
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Raymond Hettinger added the comment:
> How can we proceed with this doc fix?
Just make a new PR. I'll check it in and close the old one.
--
___
Python tracker
<https://bugs.python.org
Raymond Hettinger added the comment:
I there is a misunderstanding here. The bisect functions never point *to* a
value. Instead, they are documented to return "insertion points". Those
always occur just before or after a specific value:
values: 10 20 30 30
Raymond Hettinger added the comment:
Here's my two cents worth on the subject.
* I use hypothesis during development, but don't have a need for in the the
standard library. By the time code lands there, we normally have a specific
idea of what edge cases needs to be in the tes
Change by Raymond Hettinger :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Raymond Hettinger :
--
assignee: -> rhettinger
nosy: +rhettinger
___
Python tracker
<https://bugs.python.org/issue44227>
___
___
Python-bugs-lis
Raymond Hettinger added the comment:
New changeset 86779878dfc0bcb74b4721aba7fd9a84e9cbd5c7 by Miss Islington (bot)
in branch '3.10':
bpo-44151: linear_regression() minor API improvements (GH-26199) (GH-26338)
https://github.com/python/cpython/commit/86779878dfc0bcb74b4721aba7fd9a
Raymond Hettinger added the comment:
> Let me know if it's worth openning an issue with above improvement
I don't think so.
--
___
Python tracker
<https://bugs.pytho
Raymond Hettinger added the comment:
Ideally, we should keep argparse in line with common practices. AFAICT,
treating '-' and '_' the same isn't a norm. Click, for example, doesn't do
this.
--
nosy: +rhettinger
versions: -Python 3.10, Python 3.6,
Change by Raymond Hettinger :
--
nosy: +paul.j3
___
Python tracker
<https://bugs.python.org/issue44208>
___
___
Python-bugs-list mailing list
Unsubscribe:
Raymond Hettinger added the comment:
Zachery, unless someone steps with an objection, I think you can go forward
with the PR to implement this signature:
linear_regression(x, y, /) -> LinearRegression(slope, intercept)
--
___
Python trac
Raymond Hettinger added the comment:
I'm also dubious that this would be of value in real code. Looking at the
implementation, it seems to throw way too much code at too small of a problem.
I suspect is is more likely to cause maintenance problems than to produce
noticeable benefit
Change by Raymond Hettinger :
--
assignee: -> rhettinger
stage: resolved ->
type: -> enhancement
versions: +Python 3.11
___
Python tracker
<https://bugs.python.or
Raymond Hettinger added the comment:
> it seems too obscure and special-purpose to me to even
> qualify as a reasonable candidate for an itertools doc "recipe"
My thoughts are the same.
@latot Thank you for the suggestion but it doesn't make sense for the standard
libr
Change by Raymond Hettinger :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Raymond Hettinger added the comment:
Steven, do you approve of this?
linear_regression(x, y) -> LinearRegression(slope, intercept)
--
___
Python tracker
<https://bugs.python.org/issu
Raymond Hettinger added the comment:
FWIW, the current terminology is confusing to me as well.
--
nosy: +rhettinger
___
Python tracker
<https://bugs.python.org/issue44
601 - 700 of 9609 matches
Mail list logo