Raymond Hettinger added the comment:
You're right that this won't work for decimal because it takes a string
constructor. A fancier reduce might do the trick but it would involve
modifying the C code (no fun) as well as the Python code. Also, the conversion
from decimal to strin
Raymond Hettinger added the comment:
I constantly move back and forth between the editor and the shell, so am not
sure where the issue occurred. Also, I've never seen this one before so it
isn't easily triggered. Am running Python 3.9.5 in class. Am not using a
special build,
Raymond Hettinger added the comment:
> Just to clarify, is the proposal to return a
> regular tuple instead of named tuple?
No, it should still have named fields. Either Line or LinearRegression would
suffice.
--
___
Python tracker
Raymond Hettinger added the comment:
Any objections to linear_regression(x, y) -> (slope, intercept)?
--
___
Python tracker
<https://bugs.python.org/issu
Raymond Hettinger added the comment:
Looking over the comments so far, it looks like (x, y) would be best and
(independent variable, dependent variable) would be second best. The (x, y)
also has the advantage of matching correlation() and covariance().
For output order, it seems that
New submission from Raymond Hettinger :
Here's a new error that I hadn't seen before. I occurred at some point during
a full day training session, so am not sure what triggered the failure:
Exception in Tkinter callback
Traceback (most recent call last):
File
"/Lib
Raymond Hettinger added the comment:
Yes, this looks reasonable. Go ahead with a PR.
--
assignee: -> rhettinger
nosy: +rhettinger
type: -> performance
___
Python tracker
<https://bugs.python.org/i
Raymond Hettinger added the comment:
Related links:
*
https://support.microsoft.com/en-us/office/linest-function-84d7d0d9-6e50-4101-977a-fa7abf772b6d
*
https://www.khanacademy.org/math/statistics-probability/describing-relationships-quantitative-data/introduction-to-trend-lines/a/linear
New submission from Raymond Hettinger :
The current signature is:
linear_regression(regressor, dependent_variable)
While the term "regressor" is used in some problem domains, it isn't well known
outside of those domains. The term "independent_variable" would
Change by Raymond Hettinger :
--
keywords: +patch
pull_requests: +24800
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/26175
___
Python tracker
<https://bugs.python.org/issu
New submission from Raymond Hettinger :
Weighted averages are another basic that we should support.
A professor assigns a grade for a course by weighting quizzes at 20%, homework
at 20%, a midterm exam at 30%, and a final exam at 30%:
>>> grades = [85, 92, 83, 91]
>>> wei
Change by Raymond Hettinger :
--
nosy: +tim.peters
___
Python tracker
<https://bugs.python.org/issue44149>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Raymond Hettinger :
--
assignee: -> pitrou
nosy: +pitrou
___
Python tracker
<https://bugs.python.org/issue44136>
___
___
Python-bugs-list mai
Change by Raymond Hettinger :
--
assignee: docs@python -> rhettinger
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python
Raymond Hettinger added the comment:
New changeset a38db84122b4f664ee30b9ffd55ce87b7f4517ac by Miss Islington (bot)
in branch '3.10':
bpo-32133: Improve numbers docs (GH-26124) (GH-26149)
https://github.com/python/cpython/commit/a38db84122b4f664ee30b9ffd55ce8
Raymond Hettinger added the comment:
New changeset 376740110ecb2440fee9e04f325131aaefeb5c47 by Miss Islington (bot)
in branch '3.9':
bpo-32133: Improve numbers docs (GH-26124) (GH-26147)
https://github.com/python/cpython/commit/376740110ecb2440fee9e04f325131
Change by Raymond Hettinger :
--
assignee: rhettinger ->
___
Python tracker
<https://bugs.python.org/issue44115>
___
___
Python-bugs-list mailing list
Un
Raymond Hettinger added the comment:
Here's a minimal change:
- None of the types defined in this module can be instantiated.
+ None of the types defined in this module are intended to be instantiated.
--
nosy: +rhettinger
___
Python tr
Raymond Hettinger added the comment:
> Thoughts from others?
As it stands, the Point class is weird and atypical by only using class
variables. The example would be improved by adding @dataclass or inheriting
from typing.NamedTuple.
--
nosy: +rhettin
Raymond Hettinger added the comment:
Thanks for looking. This issue does appear to be out of date.
--
resolution: -> out of date
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Raymond Hettinger added the comment:
This needs a good deal more discussion before sweeping through the code and
change a long standing Python idiom that has stood the test of time. Until
now, no one has claimed that this is broken. You "recently noticing this"
doesn't
Raymond Hettinger added the comment:
Note for posterity: I tried out pattern matching here but it was a little
tricky and it slowed down the code a bit. At at least it worked.
if denominator is None:
match numerator:
case int(x) if type(numerator) is
Change by Raymond Hettinger :
--
assignee: -> rhettinger
nosy: +rhettinger
___
Python tracker
<https://bugs.python.org/issue44115>
___
___
Python-bugs-lis
Change by Raymond Hettinger :
--
nosy: +pitrou
___
Python tracker
<https://bugs.python.org/issue44069>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Raymond Hettinger :
--
assignee: rhettinger -> paul.j3
___
Python tracker
<https://bugs.python.org/issue43220>
___
___
Python-bugs-list mai
Raymond Hettinger added the comment:
+1 for Victor's suggestions. It provides a reasonable way forward without
locking in eval-loop implementation details that weren't intended to be public
and frozen in time.
--
___
Python track
Raymond Hettinger added the comment:
I don't think the PEP meant to restrict individual struct member such as this.
For example, we were able to switch from byte code to word code without
violating the intended rules. Consider asking Brett and Benjamin for
clarification. I would
Raymond Hettinger added the comment:
Do we have any meaningful examples to show that this is desired and useful?
The primary use case for classmethods is to serve as alternate constructors
that return new instances. That doesn't really lend itself to extending in a
subclass. User&
Change by Raymond Hettinger :
--
nosy: +rhettinger
___
Python tracker
<https://bugs.python.org/issue44090>
___
___
Python-bugs-list mailing list
Unsubscribe:
Raymond Hettinger added the comment:
FWIW, the principal use case that choices() was designed for is
resampling/bootstapping. In that use case, speed matters and small imbalances
in large sequences don't matter at all. Also, the API was designed to make it
easy to select from an ite
Raymond Hettinger added the comment:
This is known and an intentional design decision. It isn't just a speed issue.
Because the weights can be floats, we have floats involved at the outset and
some round-off is unavoidable. To keep the method internally consistent, the
same techniq
Raymond Hettinger added the comment:
Rather than request a specific solution, I'll state what new problems need to
be solved.
For teaching purposes in live demos, it is essential to have a clear visual
distinction between the inputs and outputs:
>>> beatles = ['jo
Raymond Hettinger added the comment:
This has gone stale and I've been unable to contact the OP. Marking as closed
for now. Please reopen if this comes back to life again and I'll review the PR.
--
resolution: -> remind
stage: patch review -> resolved
status
Raymond Hettinger added the comment:
Victor, thanks for the work to mitigate the costs of _PyType_GetModuleByDef().
It now has much lower overhead.
--
___
Python tracker
<https://bugs.python.org/issue40
Raymond Hettinger added the comment:
Is it possible to add a Settings option under the General tab to switch between
the sidebar mode and traditional mode?
--
___
Python tracker
<https://bugs.python.org/issue37
Change by Raymond Hettinger :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Raymond Hettinger added the comment:
Just curious, how did you find this?
--
___
Python tracker
<https://bugs.python.org/issue44039>
___
___
Python-bugs-list m
Change by Raymond Hettinger :
--
assignee: -> rhettinger
nosy: +rhettinger
___
Python tracker
<https://bugs.python.org/issue44039>
___
___
Python-bugs-lis
Raymond Hettinger added the comment:
> Specifying a 'default' with a positional doesn't make much sense.
That was my thought as well. Perhaps that is worth a note in the docs but
there is likely no real need to change the behavior.
--
Change by Raymond Hettinger :
--
pull_requests: +24574
stage: resolved -> patch review
pull_request: https://github.com/python/cpython/pull/25906
___
Python tracker
<https://bugs.python.org/issu
Raymond Hettinger added the comment:
> There is no reason to suspect a general Python performance regression
> on this benchmark between a7 and b1.
Pablo just ran the same benchmarks on Arch Linux and did not observe the
degradation, so this does seem specific to the macOS
Raymond Hettinger added the comment:
Here's the screen shot for Intel silicon running the python dot org macOS build
on Big Sur 11.3.1:
https://www.dropbox.com/s/7lmf74osvq5seg2/Screen%20Shot%202021-05-03%20at%208.41.52%20PM.png?dl=0
Here are the results on M1 Apple silicon with Big
New submission from Raymond Hettinger :
Running Tools/scripts/var_access_benchmark.py on the production macOS builds on
python.org shows a performance drop-off between alpha-7 and beta-1.
Apple Silicon
-
read local4.1ns -> 4.5ns
read non_local4.1ns ->
Change by Raymond Hettinger :
--
versions: +Python 3.11 -Python 3.10
___
Python tracker
<https://bugs.python.org/issue26680>
___
___
Python-bugs-list mailin
Change by Raymond Hettinger :
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
Change by Raymond Hettinger :
--
pull_requests: +24553
pull_request: https://github.com/python/cpython/pull/25874
___
Python tracker
<https://bugs.python.org/issue40
Raymond Hettinger added the comment:
New changeset 2995bff4269d274c0a3abfd45dc33b28f0c3e25f by Miss Islington (bot)
in branch '3.10':
bpo-44018: random.seed() no longer mutates its inputs (GH-25856) (GH-25872)
https://github.com/python/cpython/commit/2995bff4269d274c0a3abfd45dc33b
Raymond Hettinger added the comment:
New changeset e733e9951d0116e9af66b66772e708412d7f5280 by Miss Islington (bot)
in branch '3.9':
bpo-44018: random.seed() no longer mutates its inputs (GH-25856) (GH-25864)
https://github.com/python/cpython/commit/e733e9951d0116e9af66b66772e708
Change by Raymond Hettinger :
--
keywords: +patch
pull_requests: +24540
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/25856
___
Python tracker
<https://bugs.python.org/issu
Raymond Hettinger added the comment:
Okay, I now understand your report and will prepare a fix.
--
title: Bug in random.seed -> random.seed mutates input bytearray
___
Python tracker
<https://bugs.python.org/issu
Raymond Hettinger added the comment:
I don't see a bug here. As documented, "a str, bytes, or bytearray object gets
converted to an int and all of its bits are used." The various input types are
converted to an integer and it doesn't really matter how it is do
Raymond Hettinger added the comment:
There was no command-line error.
--
___
Python tracker
<https://bugs.python.org/issue43347>
___
___
Python-bugs-list mailin
Raymond Hettinger added the comment:
New changeset 8c598dbb9483bcfcb88fc579ebf27821d8861465 by Raymond Hettinger in
branch 'master':
bpo-25478: Add total() method to collections.Counter (GH-25829)
https://github.com/python/cpython/commit/8c598dbb9483bcfcb88fc579ebf278
Change by Raymond Hettinger :
--
pull_requests: +24516
pull_request: https://github.com/python/cpython/pull/25829
___
Python tracker
<https://bugs.python.org/issue25
Raymond Hettinger added the comment:
Eric, do you want to approve and apply these PRs ?
--
assignee: docs@python -> eric.smith
nosy: +rhettinger
___
Python tracker
<https://bugs.python.org/issu
Raymond Hettinger added the comment:
Webb, thanks for the report.
Zackery, thanks for the PR.
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.10
___
Python tracker
<https://bug
Raymond Hettinger added the comment:
New changeset e60b1e150d708c40fa3c51d012d9bf471f04bc70 by Miss Islington (bot)
in branch '3.9':
bpo-43990: Fix the footnote ordering in the operator precedence docs (GH-25805)
(GH-25819)
https://github.com/python/cpyt
Change by Raymond Hettinger :
--
assignee: docs@python -> rhettinger
___
Python tracker
<https://bugs.python.org/issue43990>
___
___
Python-bugs-list mai
Raymond Hettinger added the comment:
New changeset 7d2b83e9f092a2ea1f715fe028f7c48324bee756 by Zackery Spytz in
branch 'master':
bpo-43990: Fix the footnote ordering in the operator precedence docs (GH-25805)
https://github.com/python/cpython/commit/7d2b83e9f092a2ea1f715fe028f7c4
Raymond Hettinger added the comment:
I don't really like it. Carrying forward these attributes isn't the norm for
wrapping functions.
The __defaults__ argument is normally only used where it has an effect rather
than in a wrapper where it doesn't. Given that it is mutabl
Change by Raymond Hettinger :
--
nosy: +ncoghlan
___
Python tracker
<https://bugs.python.org/issue44003>
___
___
Python-bugs-list mailing list
Unsubscribe:
Raymond Hettinger added the comment:
I don't think this should be done. We want the lru_cache to be a pass-through.
Applying defaults or keyword-only/positional-only restrictions is the
responsibility of the inner function.
FWIW, here are the fields that Nick selected to be includ
Raymond Hettinger added the comment:
While you're cleaning up the module, take a look at the Quoter class. It
overrides __init__ and __missing__, so Quoter is not using any of the
defaultdict features at all. I'm thinking it could just inherit from dict.
--
nosy: +
Raymond Hettinger added the comment:
In function signatures, the square brackets do not mean that there is a list.
Instead, it is a convention used throughout the docs to mean that an argument
is optional. In this case, s.pop([i]) means that both of these are valid calls:
# retrieve
Change by Raymond Hettinger :
--
nosy: +larry
___
Python tracker
<https://bugs.python.org/issue43954>
___
___
Python-bugs-list mailing list
Unsubscribe:
Raymond Hettinger added the comment:
> I don't see a clear solution here, but I think
> it's very worth rethinking.
If you come up with a clear improvement for adding link targets, please open it
in a separate tracker issue. The other proposals in this thread have all be
Raymond Hettinger added the comment:
> I'm kind of puzzled on that fact that context manager solves it.
It "solves" the problem because of the happenstance rather than because of
language guarantees.
The current implementation of the with-statement in CPython is to gene
Raymond Hettinger added the comment:
Yes, "specify" is likely the missing word.
--
nosy: +rhettinger
___
Python tracker
<https://bugs.python.o
Raymond Hettinger added the comment:
> that was Guido's suggestion.
Well, that complicated things ;-) I suppose he can revive this if he wants.
Perhaps after seeing how pervasive the change is he will be less inclined.
Jelle, Mark, and I have all thought about it and don'
Raymond Hettinger added the comment:
I concur with Serhiy, Mark and Jelle for the reasons they listed. Am marking
this as closed. If there were a greenfield exercise, Integer would be a mildly
better choice. However, this code has long been deployed and changing it would
create more
Change by Raymond Hettinger :
--
nosy: +mark.dickinson, rhettinger, tim.peters
___
Python tracker
<https://bugs.python.org/issue43940>
___
___
Python-bugs-list m
Raymond Hettinger added the comment:
A few thoughts:
* We normally say "all bets are off" when it comes to manipulating Python
internals with ctypes. This issue is just one of many ways to wreak havoc.
* The programming pattern of killing running threads at arbitrary points
Raymond Hettinger added the comment:
Steven is right that this would be a behavior change. It is also out of line
with Python norms where all objects are born true and have to learn to be false
with either __len__ or __bool__. It is not a norm for bool(obj) to raise an
exception
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:
Here's a more compact version of the variant with an underlying dict:
class MyQueue(Queue):
def _init(self, maxsize):
self.end = 0
self.q = {}
def _qsize(self):
return len(self.q)
def
Raymond Hettinger added the comment:
> I don't think this is necessarily specific to my local build
Replace "local" with "specific to a particular combination of C compiler and
operating system". On my Mac, the effect mostly doesn't occur as all, 0.05%
b
Change by Raymond Hettinger :
--
nosy: +levkivskyi, rhettinger, serhiy.storchaka
___
Python tracker
<https://bugs.python.org/issue43923>
___
___
Python-bug
Change by Raymond Hettinger :
--
assignee: -> rhettinger
___
Python tracker
<https://bugs.python.org/issue43911>
___
___
Python-bugs-list mailing list
Un
Raymond Hettinger added the comment:
FWIW, when running your code on my Intel Mac with 16 Gb of RAM, the "after
return" result is 0.1%. So getting up to 2.2% seems to be specific to your
build.
Also, I just ran your code with a deque instrumented to count the number of
mallocs
Raymond Hettinger added the comment:
Also, when running deque measurements, run the following before getting the
starting process memory:
deque(range(2000)).clear() # fill the deque freelist
That will give a cleaner before/after comparison
Raymond Hettinger added the comment:
For a large amount of data, a list uses a single large contiguous block of
memory while a deque uses many small discontiguous blocks. In your demo, I
that suspect that some of the memory pages for deque's blocks are also being
used for other small
Raymond Hettinger added the comment:
The queue isn't being used with a maxsize.
--
nosy: -vinay.sajip
___
Python tracker
<https://bugs.python.org/is
Raymond Hettinger added the comment:
Okay, it's fixed. Thanks for the report.
--
resolution: -> fixed
stage: patch review -> resolved
status: open -> closed
type: -> behavior
versions: +Python 3.10
___
Python tracker
<htt
Raymond Hettinger added the comment:
New changeset 34be48450f03b121be10a9f8e8989603478f0469 by Miss Islington (bot)
in branch '3.9':
bpo-43917: Fix pure python equivalent for classmethod (GH-25544) (GH-25546)
https://github.com/python/cpython/commit/34be48450f03b121be10a9f8e89896
Raymond Hettinger added the comment:
New changeset 14092b5a4ae4caf1c77f685450016a0d1ad0bd6c by Raymond Hettinger in
branch 'master':
bpo-43917: Fix pure python equivalent for classmethod (GH-25544)
https://github.com/python/cpython/commit/14092b5a4ae4caf1c77f685450016a
Change by Raymond Hettinger :
--
pull_requests: +24268
pull_request: https://github.com/python/cpython/pull/25544
___
Python tracker
<https://bugs.python.org/issue43
Raymond Hettinger added the comment:
It looks like it should be:
if hasattr(type(self.f), "__get__"):
Here's the relevant C code:
static PyObject *
cm_descr_get(PyObject *self, PyObject *obj, PyObject *type)
{
classmethod *cm = (classmethod *)self;
if (cm->c
Change by Raymond Hettinger :
--
assignee: docs@python -> rhettinger
___
Python tracker
<https://bugs.python.org/issue43917>
___
___
Python-bugs-list mai
Raymond Hettinger added the comment:
This may be a memory fragmentation problem and likely doesn't have anything to
do with Queue instances.
As an experiment, try using queue.PriorityQueue and queue.LifoQueue to see if
the issue persists.
--
nosy: +rhett
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 a07da09ad5bd7d234ccd084a3a0933c290d1b592 by Raymond Hettinger in
branch 'master':
bpo-43475: Fix worst case collision behavior for NaN instances (GH-25493)
https://github.com/python/cpython/commit/a07da09ad5bd7d234ccd084a3a0933
Raymond Hettinger added the comment:
New changeset 139c232f3851b393798d0ea4e65f1298bfbcd9cf by Raymond Hettinger in
branch 'master':
bpo-40137: Move state lookups out of the critical path (GH-25492)
https://github.com/python/cpython/commit/139c232f3851b393798d0ea4e65f12
Raymond Hettinger added the comment:
It's a cute suggestion but I think it would be a distraction that makes the
docs slightly worse. The example "works" because the eye has to search to see
what makes the text special, the indentation. If you add a second special but
Change by Raymond Hettinger :
--
keywords: +patch
pull_requests: +24216
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/25493
___
Python tracker
<https://bugs.python.org/issu
Change by Raymond Hettinger :
--
pull_requests: +24215
stage: resolved -> patch review
pull_request: https://github.com/python/cpython/pull/25492
___
Python tracker
<https://bugs.python.org/issu
Raymond Hettinger added the comment:
FWIW, here's a recipe from the itertools docs:
def partition(pred, iterable):
"Use a predicate to partition entries into false entries and true
entries"
# partition(is_odd, range(10)) --> 0 2 4 6 8 and 1 3 5 7 9
Raymond Hettinger added the comment:
Please take this to the python-ideas mailing list:
https://mail.python.org/mailman3/lists/python-ideas.python.org/
If the idea gains traction, it would likely require a PEP and then this issue
can be reopened.
--
nosy: +rhettinger
resolution
Raymond Hettinger added the comment:
I've applied this PR but still am not sure that it makes readers better-off.
--
resolution: -> fixed
status: open -> closed
___
Python tracker
<https://bugs.python.
Raymond Hettinger added the comment:
Also, the related text uses callable terminology, "it returns object that ...".
--
___
Python tracker
<https://bugs.python.o
Raymond Hettinger added the comment:
-0 on doing this. While class markup has crept into the Built-in Functions
section, super() isn't really used this way (people don't subclass it or run
isinstance on it).
Elsewhere in the docs, all the links to this entry use the markup,
:f
701 - 800 of 9609 matches
Mail list logo