[issue44154] Optimize Fraction pickling

2021-05-19 Thread Raymond Hettinger
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

[issue44163] IDLE ValueError in HyperParser

2021-05-19 Thread Raymond Hettinger
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,

[issue44151] Improve parameter names and return value ordering for linear_regression

2021-05-19 Thread Raymond Hettinger
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

[issue44151] Improve parameter names and return value ordering for linear_regression

2021-05-18 Thread Raymond Hettinger
Raymond Hettinger added the comment: Any objections to linear_regression(x, y) -> (slope, intercept)? -- ___ Python tracker <https://bugs.python.org/issu

[issue44151] Improve parameter names and return value ordering for linear_regression

2021-05-17 Thread Raymond Hettinger
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

[issue44163] IDLE ValueError in HyperParser

2021-05-17 Thread Raymond Hettinger
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

[issue44154] Optimize Fraction pickling

2021-05-16 Thread Raymond Hettinger
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

[issue44151] Improve parameter names and return value ordering for linear_regression

2021-05-16 Thread Raymond Hettinger
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

[issue44151] Improve parameter names and return value ordering for linear_regression

2021-05-16 Thread Raymond Hettinger
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

[issue44150] Add optional weights parameter to statistics.fmean()

2021-05-16 Thread Raymond Hettinger
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

[issue44150] Add optional weights parameter to statistics.fmean()

2021-05-16 Thread Raymond Hettinger
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

[issue44149] difflib.get_close_matches: Add `key` argument

2021-05-16 Thread Raymond Hettinger
Change by Raymond Hettinger : -- nosy: +tim.peters ___ Python tracker <https://bugs.python.org/issue44149> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue44136] Remove pathlib flavours

2021-05-15 Thread Raymond Hettinger
Change by Raymond Hettinger : -- assignee: -> pitrou nosy: +pitrou ___ Python tracker <https://bugs.python.org/issue44136> ___ ___ Python-bugs-list mai

[issue32133] documentation: numbers module nitpick

2021-05-15 Thread Raymond Hettinger
Change by Raymond Hettinger : -- assignee: docs@python -> rhettinger resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python

[issue32133] documentation: numbers module nitpick

2021-05-15 Thread Raymond Hettinger
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

[issue32133] documentation: numbers module nitpick

2021-05-15 Thread Raymond Hettinger
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

[issue44115] Improve conversions for fractions

2021-05-14 Thread Raymond Hettinger
Change by Raymond Hettinger : -- assignee: rhettinger -> ___ Python tracker <https://bugs.python.org/issue44115> ___ ___ Python-bugs-list mailing list Un

[issue32133] documentation: numbers module nitpick

2021-05-14 Thread Raymond Hettinger
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

[issue44109] missing dataclass decorator in match-statement example

2021-05-14 Thread Raymond Hettinger
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

[issue37891] Exceptions tutorial page does not mention raise from

2021-05-14 Thread Raymond Hettinger
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

[issue44123] make function parameter sentinel value true singletons

2021-05-13 Thread Raymond Hettinger
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

[issue44115] Improve conversions for fractions

2021-05-13 Thread Raymond Hettinger
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

[issue44115] Improve conversions for fractions

2021-05-12 Thread Raymond Hettinger
Change by Raymond Hettinger : -- assignee: -> rhettinger nosy: +rhettinger ___ Python tracker <https://bugs.python.org/issue44115> ___ ___ Python-bugs-lis

[issue44069] pathlib.Path.glob's generator is not a real generator

2021-05-12 Thread Raymond Hettinger
Change by Raymond Hettinger : -- nosy: +pitrou ___ Python tracker <https://bugs.python.org/issue44069> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue43220] Argparse: Explicit default required arguments with add_mutually_exclusive_group are rejected

2021-05-11 Thread Raymond Hettinger
Change by Raymond Hettinger : -- assignee: rhettinger -> paul.j3 ___ Python tracker <https://bugs.python.org/issue43220> ___ ___ Python-bugs-list mai

[issue43760] The DISPATCH() macro is not as efficient as it could be (move PyThreadState.use_tracing)

2021-05-10 Thread Raymond Hettinger
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

[issue43760] The DISPATCH() macro is not as efficient as it could be.

2021-05-10 Thread Raymond Hettinger
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

[issue44090] Add class binding to unbound super objects for allowing autosuper with class methods

2021-05-09 Thread Raymond Hettinger
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&

[issue44090] Add class binding to unbound super objects for allowing autosuper with class methods

2021-05-09 Thread Raymond Hettinger
Change by Raymond Hettinger : -- nosy: +rhettinger ___ Python tracker <https://bugs.python.org/issue44090> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue44080] Bias in random.choices(long_sequence)

2021-05-09 Thread Raymond Hettinger
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

[issue44080] Bias in random.choices(long_sequence)

2021-05-09 Thread Raymond Hettinger
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

[issue37903] IDLE Shell sidebar.

2021-05-07 Thread Raymond Hettinger
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

[issue26680] Incorporating float.is_integer into Decimal

2021-05-06 Thread Raymond Hettinger
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

[issue40137] TODO list when PEP 573 "Module State Access from C Extension Methods" will be implemented

2021-05-05 Thread Raymond Hettinger
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

[issue37903] IDLE Shell sidebar.

2021-05-05 Thread Raymond Hettinger
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

[issue44039] Duplicated assignment in Modules/_randommodule.c

2021-05-04 Thread Raymond Hettinger
Change by Raymond Hettinger : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue44039] Duplicated assignment in Modules/_randommodule.c

2021-05-04 Thread Raymond Hettinger
Raymond Hettinger added the comment: Just curious, how did you find this? -- ___ Python tracker <https://bugs.python.org/issue44039> ___ ___ Python-bugs-list m

[issue44039] Duplicated assignment in Modules/_randommodule.c

2021-05-04 Thread Raymond Hettinger
Change by Raymond Hettinger : -- assignee: -> rhettinger nosy: +rhettinger ___ Python tracker <https://bugs.python.org/issue44039> ___ ___ Python-bugs-lis

[issue43192] Argparse complains argument required when default is provided

2021-05-04 Thread Raymond Hettinger
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. --

[issue40521] [subinterpreters] Make free lists and unicode caches per-interpreter

2021-05-04 Thread Raymond Hettinger
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

[issue44037] Broad performance regression from 3.10a7 to 3.10b1 with python.org macOS binaries

2021-05-04 Thread Raymond Hettinger
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

[issue44037] Broad performance regression from 3.10a7 to 3.10b1

2021-05-04 Thread Raymond Hettinger
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

[issue44037] Broad performance regression from 3.10a7 to 3.10b1

2021-05-04 Thread Raymond Hettinger
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 ->

[issue26680] Incorporating float.is_integer into Decimal

2021-05-03 Thread Raymond Hettinger
Change by Raymond Hettinger : -- versions: +Python 3.11 -Python 3.10 ___ Python tracker <https://bugs.python.org/issue26680> ___ ___ Python-bugs-list mailin

[issue44018] random.seed mutates input bytearray

2021-05-03 Thread Raymond Hettinger
Change by Raymond Hettinger : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue40465] Deprecate the optional *random* argument to random.shuffle()

2021-05-03 Thread Raymond Hettinger
Change by Raymond Hettinger : -- pull_requests: +24553 pull_request: https://github.com/python/cpython/pull/25874 ___ Python tracker <https://bugs.python.org/issue40

[issue44018] random.seed mutates input bytearray

2021-05-03 Thread Raymond Hettinger
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

[issue44018] random.seed mutates input bytearray

2021-05-03 Thread Raymond Hettinger
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

[issue44018] random.seed mutates input bytearray

2021-05-03 Thread Raymond Hettinger
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

[issue44018] random.seed mutates input bytearray

2021-05-03 Thread Raymond Hettinger
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

[issue44018] Bug in random.seed

2021-05-03 Thread Raymond Hettinger
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

[issue43347] IDLE crashes in macOS Apple chip, maybe completions

2021-05-02 Thread Raymond Hettinger
Raymond Hettinger added the comment: There was no command-line error. -- ___ Python tracker <https://bugs.python.org/issue43347> ___ ___ Python-bugs-list mailin

[issue25478] Consider adding a normalize() method to collections.Counter()

2021-05-02 Thread Raymond Hettinger
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

[issue25478] Consider adding a normalize() method to collections.Counter()

2021-05-02 Thread Raymond Hettinger
Change by Raymond Hettinger : -- pull_requests: +24516 pull_request: https://github.com/python/cpython/pull/25829 ___ Python tracker <https://bugs.python.org/issue25

[issue41411] Improve and consolidate f-strings docs

2021-05-02 Thread Raymond Hettinger
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

[issue43990] In documentation Section 6.17, Operator precedence, footnotes 5 & 6 are reversed

2021-05-02 Thread Raymond Hettinger
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

[issue43990] In documentation Section 6.17, Operator precedence, footnotes 5 & 6 are reversed

2021-05-02 Thread Raymond Hettinger
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

[issue43990] In documentation Section 6.17, Operator precedence, footnotes 5 & 6 are reversed

2021-05-02 Thread Raymond Hettinger
Change by Raymond Hettinger : -- assignee: docs@python -> rhettinger ___ Python tracker <https://bugs.python.org/issue43990> ___ ___ Python-bugs-list mai

[issue43990] In documentation Section 6.17, Operator precedence, footnotes 5 & 6 are reversed

2021-05-02 Thread Raymond Hettinger
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

[issue44003] functools.lru_cache omits __defaults__ attribute from wrapped function

2021-05-01 Thread Raymond Hettinger
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

[issue44003] functools.lru_cache omits __defaults__ attribute from wrapped function

2021-05-01 Thread Raymond Hettinger
Change by Raymond Hettinger : -- nosy: +ncoghlan ___ Python tracker <https://bugs.python.org/issue44003> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue44003] functools.lru_cache omits __defaults__ attribute from wrapped function

2021-05-01 Thread Raymond Hettinger
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

[issue44002] Use functools.lru_cache in urllib.parse instead of 1996 custom caching

2021-05-01 Thread Raymond Hettinger
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: +

[issue43996] Doc for mutable sequence pop() method implies argument is a slice or sequence.

2021-04-30 Thread Raymond Hettinger
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

[issue43954] Possible missing word on unittest doc

2021-04-28 Thread Raymond Hettinger
Change by Raymond Hettinger : -- nosy: +larry ___ Python tracker <https://bugs.python.org/issue43954> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue11975] Fix referencing of built-in types (list, int, ...)

2021-04-28 Thread Raymond Hettinger
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

[issue43939] Deadlock in logging

2021-04-27 Thread Raymond Hettinger
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

[issue43954] Possible missing word on unittest doc

2021-04-27 Thread Raymond Hettinger
Raymond Hettinger added the comment: Yes, "specify" is likely the missing word. -- nosy: +rhettinger ___ Python tracker <https://bugs.python.o

[issue32891] Add 'Integer' as synonym for 'Integral' in numbers module.

2021-04-27 Thread Raymond Hettinger
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'

[issue32891] Add 'Integer' as synonym for 'Integral' in numbers module.

2021-04-26 Thread Raymond Hettinger
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

[issue43940] int casting to float results to a different value in memory

2021-04-25 Thread Raymond Hettinger
Change by Raymond Hettinger : -- nosy: +mark.dickinson, rhettinger, tim.peters ___ Python tracker <https://bugs.python.org/issue43940> ___ ___ Python-bugs-list m

[issue43939] Deadlock in logging

2021-04-25 Thread Raymond Hettinger
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

[issue43929] Raise on threading.Event.__bool__ due to ambiguous nature

2021-04-24 Thread Raymond Hettinger
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

[issue43928] Fix the typo in documentation

2021-04-23 Thread Raymond Hettinger
Change by Raymond Hettinger : -- resolution: -> not a bug stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue43911] Queue.get() memory leak

2021-04-23 Thread Raymond Hettinger
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

[issue43911] Queue.get() memory leak

2021-04-23 Thread Raymond Hettinger
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

[issue43923] Can't create generic NamedTuple as of py3.9

2021-04-23 Thread Raymond Hettinger
Change by Raymond Hettinger : -- nosy: +levkivskyi, rhettinger, serhiy.storchaka ___ Python tracker <https://bugs.python.org/issue43923> ___ ___ Python-bug

[issue43911] Queue.get() memory leak

2021-04-23 Thread Raymond Hettinger
Change by Raymond Hettinger : -- assignee: -> rhettinger ___ Python tracker <https://bugs.python.org/issue43911> ___ ___ Python-bugs-list mailing list Un

[issue43911] Queue.get() memory leak

2021-04-23 Thread Raymond Hettinger
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

[issue43911] Queue.get() memory leak

2021-04-23 Thread Raymond Hettinger
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

[issue43911] Queue.get() memory leak

2021-04-23 Thread Raymond Hettinger
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

[issue43877] Logging Cookbook ambiguity

2021-04-22 Thread Raymond Hettinger
Raymond Hettinger added the comment: The queue isn't being used with a maxsize. -- nosy: -vinay.sajip ___ Python tracker <https://bugs.python.org/is

[issue43917] An error in classmethod example in the documentation of descriptor

2021-04-22 Thread Raymond Hettinger
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

[issue43917] An error in classmethod example in the documentation of descriptor

2021-04-22 Thread Raymond Hettinger
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

[issue43917] An error in classmethod example in the documentation of descriptor

2021-04-22 Thread Raymond Hettinger
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

[issue43917] An error in classmethod example in the documentation of descriptor

2021-04-22 Thread Raymond Hettinger
Change by Raymond Hettinger : -- pull_requests: +24268 pull_request: https://github.com/python/cpython/pull/25544 ___ Python tracker <https://bugs.python.org/issue43

[issue43917] An error in classmethod example in the documentation of descriptor

2021-04-22 Thread Raymond Hettinger
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

[issue43917] An error in classmethod example in the documentation of descriptor

2021-04-22 Thread Raymond Hettinger
Change by Raymond Hettinger : -- assignee: docs@python -> rhettinger ___ Python tracker <https://bugs.python.org/issue43917> ___ ___ Python-bugs-list mai

[issue43911] Queue.get() memory leak

2021-04-22 Thread Raymond Hettinger
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

[issue43475] Worst-case behaviour of hash collision with float NaN

2021-04-22 Thread Raymond Hettinger
Change by Raymond Hettinger : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue43475] Worst-case behaviour of hash collision with float NaN

2021-04-22 Thread Raymond Hettinger
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

[issue40137] TODO list when PEP 573 "Module State Access from C Extension Methods" will be implemented

2021-04-21 Thread Raymond Hettinger
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

[issue43904] Documentation for argparse, missed opportunity

2021-04-21 Thread Raymond Hettinger
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

[issue43475] Worst-case behaviour of hash collision with float NaN

2021-04-20 Thread Raymond Hettinger
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

[issue40137] TODO list when PEP 573 "Module State Access from C Extension Methods" will be implemented

2021-04-20 Thread Raymond Hettinger
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

[issue43899] separate builtin function

2021-04-20 Thread Raymond Hettinger
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

[issue43900] string comprehension

2021-04-20 Thread Raymond Hettinger
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

[issue43896] Update the Sphinx directive for super from function to class

2021-04-20 Thread Raymond Hettinger
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.

[issue43896] Update the Sphinx directive for super from function to class

2021-04-20 Thread Raymond Hettinger
Raymond Hettinger added the comment: Also, the related text uses callable terminology, "it returns object that ...". -- ___ Python tracker <https://bugs.python.o

[issue43896] Update the Sphinx directive for super from function to class

2021-04-20 Thread Raymond Hettinger
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

<    3   4   5   6   7   8   9   10   11   12   >