[issue45918] Possibly use ROUND_05UP in decimal's localcontext() example

2021-11-28 Thread Raymond Hettinger
New submission from Raymond Hettinger : Candidate example: with localcontext() as ctx: ctx.prec += 10# Perform a higher precision calculation ctx.rounding = ROUND_05UP # Avoid double rounding of the final calculation step s = calculate_something() s

[issue45917] Add math.exp2() function: 2^x

2021-11-28 Thread Raymond Hettinger
Change by Raymond Hettinger : -- nosy: +mark.dickinson, rhettinger, serhiy.storchaka, tim.peters ___ Python tracker <https://bugs.python.org/issue45917> ___ ___

[issue45739] The Python implementation of Decimal does not support the "N" format

2021-11-28 Thread Raymond Hettinger
Raymond Hettinger added the comment: I support deprecating "N". -- ___ Python tracker <https://bugs.python.org/issue45739> ___ ___ Python-bugs-l

[issue33376] [pysqlite] Duplicate rows can be returned after rolling back a transaction

2021-11-27 Thread Raymond Hettinger
Change by Raymond Hettinger : -- stage: resolved -> ___ Python tracker <https://bugs.python.org/issue33376> ___ ___ Python-bugs-list mailing list Unsubscrib

[issue45908] dict.fromkeys insertion order

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

[issue45908] dict.fromkeys insertion order

2021-11-27 Thread Raymond Hettinger
Raymond Hettinger added the comment: Thanks for the suggestion but I’m going to decline. We has many APIS that consume an iterable and all of them do so In iteration order. Even the regular dict() constructor takes an iterable of tuples and adds them in iteration order. Also, I’m

[issue45902] Bytes and bytesarrays can be sorted with a much faster count sort.

2021-11-27 Thread Raymond Hettinger
Raymond Hettinger added the comment: I’m -1 on this. Given that use cases are rare, there is no need to burden the code base with an optimization of something we can already do in other ways. Also, I don’t like that the APIs for list.sort(), bytes.sort(), and bytearray.sort() wouldn’t match

[issue45908] dict.fromkeys insertion order

2021-11-27 Thread Raymond Hettinger
Raymond Hettinger added the comment: All the dict methods retain insertion order. There is nothing special about fromkeys(). -- ___ Python tracker <https://bugs.python.org/issue45

[issue45876] Improve accuracy of stdev functions in statistics

2021-11-26 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset af9ee57b96cb872df6574e36027cc753417605f9 by Raymond Hettinger in branch 'main': bpo-45876: Improve accuracy for stdev() and pstdev() in statistics (GH-29736) https://github.com/python/cpython/commit/af9ee57b96cb872df6574e36027cc753417605f9

[issue45876] Improve accuracy of stdev functions in statistics

2021-11-26 Thread Raymond Hettinger
Raymond Hettinger added the comment: Thank you all for looking at this. It's unlikely that anyone will ever notice the improvement, but I'm happy with it and that's all the matters ;-) -- ___ Python tracker <https://bugs.python.org/issue45

[issue45876] Improve accuracy of stdev functions in statistics

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

[issue45876] Improve accuracy of stdev functions in statistics

2021-11-26 Thread Raymond Hettinger
Raymond Hettinger added the comment: > It won't affect _this_ application, but possibly we should > fix this anyway. I would like to see this fixed. It affects our ability to reason about int/int code. That comes up every time a fraction is fed into a math library function than co

[issue45907] Optimize literal comparisons and contains

2021-11-26 Thread Raymond Hettinger
Raymond Hettinger added the comment: This PR looks to be the same as one that was recently rejected. Compare: https://github.com/python/cpython/pull/29639/files https://github.com/python/cpython/pull/29810/files See discussion at: https://bugs.python.org/issue45843 -- nosy

[issue45876] Improve accuracy of stdev functions in statistics

2021-11-26 Thread Raymond Hettinger
Raymond Hettinger added the comment: [Tim] > Note that, on Windows, ldexp() in the presence of > denorms can truncate. Division rounds, so > >assert x / 2**i == ldexp(x, -i) > > can fail. Objects/longobject.c::long_true_divide() uses ldexp() internally. Will it suff

[issue45876] Improve accuracy of stdev functions in statistics

2021-11-26 Thread Raymond Hettinger
Raymond Hettinger added the comment: Instead of calling float(), perhaps do an int/int division to match the other code path so that the function depends on only one mechanism for building the float result. -return float(_isqrt_frac_rto(n, m << 2 * q) << q) +(_isqrt_f

[issue45876] Improve accuracy of stdev functions in statistics

2021-11-25 Thread Raymond Hettinger
Raymond Hettinger added the comment: Mark, would it preferable to use ldexp() to build the float? + return math.ldexp(isqrt_frac_rto(n << -2 * q, m), q) - return isqrt_frac_rto(n << -2 * q, m) / (1 << -q) -- ___ Pyth

[issue45876] Improve accuracy of stdev functions in statistics

2021-11-24 Thread Raymond Hettinger
Raymond Hettinger added the comment: > Here's a reference for this use of round-to-odd: > https://www.lri.fr/~melquion/doc/05-imacs17_1-expose.pdf Thanks Mark. It looks like I'll be getting a little education over the Thanksgiving holiday :-) Shown below is the code that I'm th

[issue45876] Improve accuracy of stdev functions in statistics

2021-11-23 Thread Raymond Hettinger
Raymond Hettinger added the comment: As a side effect of inlining the variance code, we also get to fix the error messages which were variance specific. -- ___ Python tracker <https://bugs.python.org/issue45

[issue45876] Improve accuracy of stdev functions in statistics

2021-11-23 Thread Raymond Hettinger
Raymond Hettinger added the comment: I've opened a PR to make this easy to experiment with. It also worked with my frac_sqrt() and deci_sqrt(), but having all integer arithmetic and always correct rounding are nice wins. The only downside is that I completely understood the first two

[issue45876] Improve accuracy of stdev functions in statistics

2021-11-23 Thread Raymond Hettinger
Change by Raymond Hettinger : -- keywords: +patch pull_requests: +27974 stage: -> patch review pull_request: https://github.com/python/cpython/pull/29736 ___ Python tracker <https://bugs.python.org/issu

[issue45876] Improve accuracy of stdev functions in statistics

2021-11-23 Thread Raymond Hettinger
Raymond Hettinger added the comment: Should the last line of sqrt_frac() be wrapped with float()? -- ___ Python tracker <https://bugs.python.org/issue45

[issue45880] Performance regression of Int object operators. (Python 3.11)

2021-11-23 Thread Raymond Hettinger
Raymond Hettinger added the comment: Reposting with more careful timing runs. No regression was observed. $ python3.10 --version Python 3.10.0 $ python3.10 -m timeit -r 11 -s 'x=5' 'x^3'# Xor with variable 500 loops, best of 11: 41.7 nsec per loop $ python3.10 -m timeit -r 11 -s 'x=5

[issue45876] Improve accuracy of stdev functions in statistics

2021-11-23 Thread Raymond Hettinger
Raymond Hettinger added the comment: > It wouldn't be hard to go for _always_ correctly rounded > and actually get it over. Yes, that would be the right thing to do. Does the technique you had in mind involve testing 1 ulp up or down to see whether its square is closer to the

[issue45880] Performance regression of Int object operators. (Python 3.11)

2021-11-23 Thread Raymond Hettinger
Raymond Hettinger added the comment: Here are timings from stock macOS builds from python.org: $ python3.10 --version Python 3.10.0 $ python3.10 -m timeit -r 11 -s 'x=5' 'x^3' # Xor with variable 500 loops, best of 11: 41.4 nsec per loop $ python3.10 -m timeit -r 11 -s 'x=5' 'x+3

[issue45876] Improve accuracy of stdev functions in statistics

2021-11-23 Thread Raymond Hettinger
Raymond Hettinger added the comment: > I'm not sure this is worth worrying about ... Instead of writing simple, mostly accurate code with math.fsum(), these functions have already applied labor intensive measures to get an exact mean and exact sum of square differences expres

[issue45876] Improve accuracy of stdev functions in statistics

2021-11-23 Thread Raymond Hettinger
New submission from Raymond Hettinger : The standard deviation computation in the statistics module is still subject to error even though the mean and sum of square differences are computed exactly using fractions. The problem is that the exact fraction gets rounded to a float before going

[issue45859] test_collections has a wrong test in case _itemgetter is not available

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

[issue45859] test_collections has a wrong test in case _itemgetter is not available

2021-11-22 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset 455ed45d7c30c5f2a31c524b015c48ac85f3d27c by Miss Islington (bot) in branch '3.9': bpo-45859: Mark test_field_descriptor in test_collections as CPython-only (GH-29691) (GH-29709) https://github.com/python/cpython/commit

[issue45859] test_collections has a wrong test in case _itemgetter is not available

2021-11-22 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset 56b5cd52ab58d8f2f11f253ec1bb3e6000d2dbd2 by Miss Islington (bot) in branch '3.10': bpo-45859: Mark test_field_descriptor in test_collections as CPython-only (GH-29691) (GH-29708) https://github.com/python/cpython/commit

[issue45859] test_collections has a wrong test in case _itemgetter is not available

2021-11-22 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset 4fad314246399b69ef0c57ba8527d9efade99069 by Carl Friedrich Bolz-Tereick in branch 'main': bpo-45859: Mark test_field_descriptor in test_collections as CPython-only (GH-29691) https://github.com/python/cpython/commit

[issue45859] test_collections has a wrong test in case _itemgetter is not available

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

[issue45766] Add direct proportion option to statistics.linear_regression()

2021-11-21 Thread Raymond Hettinger
Raymond Hettinger added the comment: Thanks for looking at this and giving it some good thought. -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue45766] Add direct proportion option to statistics.linear_regression()

2021-11-21 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset d2b55b07d2b503dcd3b5c0e2753efa835cff8e8f by Raymond Hettinger in branch 'main': bpo-45766: Add direct proportion option to linear_regression(). (#29490) https://github.com/python/cpython/commit/d2b55b07d2b503dcd3b5c0e2753efa835cff8e8f

[issue45856] [doc] map() documentation ambiguous about consumption order

2021-11-20 Thread Raymond Hettinger
Raymond Hettinger added the comment: I don't think this suggestion is helpful or necessary. The map() docs have been around for a long time and this hasn't proven to be a point of confusion. The itertools docs already have a recipe demonstrating the technique of passing the same

[issue45856] [doc] map() documentation ambiguous about consumption order

2021-11-20 Thread Raymond Hettinger
Change by Raymond Hettinger : -- resolution: -> rejected stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue45852] statistics.mode test doesn't test what it claims to

2021-11-20 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset 9841ac2da5689ff765250c1abdbf5af9d3750519 by Miss Islington (bot) in branch '3.10': bpo-45852: Fix the Counter/iter test for statistics.mode() (GH-29667) (GH-29671) https://github.com/python/cpython/commit

[issue45852] statistics.mode test doesn't test what it claims to

2021-11-20 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset 48744db70ed519c1566c22bf123a0e1f5c69253f by Raymond Hettinger in branch 'main': bpo-45852: Fix the Counter/iter test for statistics.mode() (GH-29667) https://github.com/python/cpython/commit/48744db70ed519c1566c22bf123a0e1f5c69253f

[issue45852] statistics.mode test doesn't test what it claims to

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

[issue45852] statistics.mode test doesn't test what it claims to

2021-11-20 Thread Raymond Hettinger
Raymond Hettinger added the comment: Thanks for noticing this. -- resolution: -> fixed stage: patch review -> resolved status: open -> closed versions: +Python 3.11 ___ Python tracker <https://bugs.python.or

[issue45852] statistics.mode test doesn't test what it claims to

2021-11-20 Thread Raymond Hettinger
Change by Raymond Hettinger : -- keywords: +patch pull_requests: +27908 stage: -> patch review pull_request: https://github.com/python/cpython/pull/29667 ___ Python tracker <https://bugs.python.org/issu

[issue45851] statistics.multimode is inefficient (time and space) (mode somewhat, too)

2021-11-20 Thread Raymond Hettinger
Raymond Hettinger added the comment: Accepting the suggestion for multimode() to use max() instead of a full sort. This is a nice improvement. Thank you. Leaving mode() as-is. The existing code is cleaner and does its work in a single pass over the counter. -- resolution

[issue45851] statistics.multimode is inefficient (time and space) (mode somewhat, too)

2021-11-20 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset 04e03f496cf7da48ce4f545b41579d7d45f59ad2 by Raymond Hettinger in branch 'main': bpo-45851: Avoid full sort in statistics.multimode() (#29662) https://github.com/python/cpython/commit/04e03f496cf7da48ce4f545b41579d7d45f59ad2

[issue45851] statistics.multimode is inefficient (time and space) (mode somewhat, too)

2021-11-20 Thread Raymond Hettinger
Change by Raymond Hettinger : -- keywords: +patch pull_requests: +27904 stage: -> patch review pull_request: https://github.com/python/cpython/pull/29662 ___ Python tracker <https://bugs.python.org/issu

[issue45851] statistics.multimode is inefficient (time and space) (mode somewhat, too)

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

[issue45356] Calling `help` executes @classmethod @property decorated methods

2021-11-19 Thread Raymond Hettinger
Raymond Hettinger added the comment: I propose deprecating classmethod chaining. It has become clear that it doesn't really do what people wanted and can't easily be made to work. By even suggesting that some stateful decorators are composable, we've ventured onto thin ice. Wrapping

[issue45356] Calling `help` executes @classmethod @property decorated methods

2021-11-19 Thread Raymond Hettinger
Raymond Hettinger added the comment: Also see: https://bugs.python.org/issue42073 The classmethod pass through broke some existing code and the "fix" for it looks dubious: if hasattr(type(self.f), '__get__'): return self.f.__get_

[issue19072] classmethod doesn't honour descriptor protocol of wrapped callable

2021-11-18 Thread Raymond Hettinger
Change by Raymond Hettinger : -- pull_requests: +27866 pull_request: https://github.com/python/cpython/pull/29634 ___ Python tracker <https://bugs.python.org/issue19

[issue45235] argparse does not preserve namespace with subparser defaults

2021-11-18 Thread Raymond Hettinger
Raymond Hettinger added the comment: Paul, should this be closed or do you think there is still a namespace issue to be resolved? -- assignee: rhettinger -> ___ Python tracker <https://bugs.python.org/issu

[issue45832] Misleading membersip expression documentation

2021-11-17 Thread Raymond Hettinger
Raymond Hettinger added the comment: This section presumes that the usual hash invariant holds: a==b implies hash(a)==hash(b). We could repeat that here but I don't think it makes the docs better or more useable to require that docs repeat the same facts in multiple places. Alternatively

[issue45760] Remove "PyNumber_InMatrixMultiply"

2021-11-16 Thread Raymond Hettinger
Raymond Hettinger added the comment: Alternatively, fix the misspelling in the macro and delete the redundant expanded code below. -- nosy: +rhettinger ___ Python tracker <https://bugs.python.org/issue45

[issue45824] CSV module document does not include how to append files

2021-11-16 Thread Raymond Hettinger
Raymond Hettinger added the comment: I don't think that is the job of CSV docs. Appending is a general skill and not specific to that module. Likewise, the CSV module docs don't cover other general file manipulation skills like closing, using seek() to rewind, manipulating filenames

[issue45819] Avoid releasing the GIL in nonblocking socket operations

2021-11-16 Thread Raymond Hettinger
Raymond Hettinger added the comment: +1 There is almost no upside for the current behavior. -- nosy: +rhettinger ___ Python tracker <https://bugs.python.org/issue45

[issue44295] self.assertDictContainsSubset warning is unhelpful

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

[issue45054] json module should issue warning about duplicate keys

2021-11-13 Thread Raymond Hettinger
Change by Raymond Hettinger : -- assignee: -> bob.ippolito ___ Python tracker <https://bugs.python.org/issue45054> ___ ___ Python-bugs-list mailing list Un

[issue45054] json module should issue warning about duplicate keys

2021-11-13 Thread Raymond Hettinger
Raymond Hettinger added the comment: -0 on doing this. The suggested warning/error adds overhead that everyone would pay for but would almost never be of benefit. I haven't seen this particular problem arise in practice. The likely reasons it doesn't come up are 1) that generated data

[issue37295] Possible optimizations for math.comb()

2021-11-13 Thread Raymond Hettinger
Raymond Hettinger added the comment: These speedups all to be significant and worth doing. -- ___ Python tracker <https://bugs.python.org/issue37295> ___ ___

[issue45235] argparse does not preserve namespace with subparser defaults

2021-11-12 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset e4c5a5eabadd1dcd0b522ffbd70157cd95506ad1 by Miss Islington (bot) in branch '3.10': bpo-45235: Revert an argparse bugfix that caused a regression (GH-29525) (GH-29530) https://github.com/python/cpython/commit

[issue45235] argparse does not preserve namespace with subparser defaults

2021-11-12 Thread Raymond Hettinger
Raymond Hettinger added the comment: I've restored the prior state of affairs. Leaving this issue open because it still isn't clear what should be guaranteed or whether further improvements need to be made. -- priority: high -> normal ___ Pyt

[issue45235] argparse does not preserve namespace with subparser defaults

2021-11-12 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset 587ff7f50bcbfd8346c6d5db459a1628a350c04d by Miss Islington (bot) in branch '3.9': bpo-45235: Revert an argparse bugfix that caused a regression (GH-29525) (GH-29531) https://github.com/python/cpython/commit

[issue45791] __instancecheck__ being checked on type(cls) instead of cls

2021-11-12 Thread Raymond Hettinger
Raymond Hettinger added the comment: Here's an example in PEP 3119 that appears to work but actually bypasses the method: from abc import ABCMeta, abstractmethod class Sized(metaclass=ABCMeta): @abstractmethod def __hash__(self): return 0 @classmethod def

[issue45791] __instancecheck__ being checked on type(cls) instead of cls

2021-11-12 Thread Raymond Hettinger
Raymond Hettinger added the comment: I did a scan of the standard library and code in the wild. It looks like almost all uses are in metaclasses (which makes sense because that matches the AppendableSequence example in PEP 3119). However, the typing module does have some cases

[issue45791] __instancecheck__ being checked on type(cls) instead of cls

2021-11-12 Thread Raymond Hettinger
Raymond Hettinger added the comment: FWIW, I discovered the issue when experimenting with ways to use the class pattern in structural pattern matching. --- Code that should work but doesn't --- class Warm: def __instancecheck__(cls, inst): return inst in {'red', 'orange

[issue45791] __instancecheck__ being checked on type(cls) instead of cls

2021-11-12 Thread Raymond Hettinger
Change by Raymond Hettinger : -- title: __instancecheck__ being checked of type(cls) instead of cls -> __instancecheck__ being checked on type(cls) instead of cls ___ Python tracker <https://bugs.python.org/issu

[issue45791] __instancecheck__ being checked of type(cls) instead of cls

2021-11-12 Thread Raymond Hettinger
Raymond Hettinger added the comment: > As in most (but not all) cases of dunder methods it > is looked up in a class, ignoring instance attributes. That is true, but the starting point in this case is a class so the attribute lookup should be in that class, not its metaclass. G

[issue45791] __instancecheck__ being checked of type(cls) instead of cls

2021-11-11 Thread Raymond Hettinger
New submission from Raymond Hettinger : Per PEP 3119, "Overloading works as follows: The call isinstance(x, C) first checks whether C.__instancecheck__ exists, and if so, calls C.__instancecheck__(x) instead of its normal implementation." However, this doesn't work because the

[issue45235] argparse does not preserve namespace with subparser defaults

2021-11-11 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset 807f839bbfd5805fb76eb3436c9252a0441296eb by Raymond Hettinger in branch 'main': bpo-45235: Revert an argparse bugfix that caused a regression (GH-29525) https://github.com/python/cpython/commit/807f839bbfd5805fb76eb3436c9252a0441296eb

[issue45235] argparse does not preserve namespace with subparser defaults

2021-11-11 Thread Raymond Hettinger
Raymond Hettinger added the comment: Only 3.9 needs an expedited rerelease. -- ___ Python tracker <https://bugs.python.org/issue45235> ___ ___ Python-bugs-list m

[issue45235] argparse does not preserve namespace with subparser defaults

2021-11-11 Thread Raymond Hettinger
Raymond Hettinger added the comment: How long until the next bugfix releases for 3.9 and 3.10? To avoid further snowballing, it would be great to have this reversion pushed out soonish. -- nosy: +pablogsal priority: normal -> high ___ Pyt

[issue45235] argparse does not preserve namespace with subparser defaults

2021-11-11 Thread Raymond Hettinger
Change by Raymond Hettinger : -- pull_requests: +27775 stage: needs patch -> patch review pull_request: https://github.com/python/cpython/pull/29525 ___ Python tracker <https://bugs.python.org/issu

[issue45766] Add direct proportion option to statistics.linear_regression()

2021-11-11 Thread Raymond Hettinger
Raymond Hettinger added the comment: It usually isn't wise to be preachy in the docs, but we could add a suggestion that proportional=True be used only when (0, 0) is known to be in the dataset and when it is in the same neighborhood as the other data points. A reasonable cross-check would

[issue45766] Add direct proportion option to statistics.linear_regression()

2021-11-10 Thread Raymond Hettinger
Raymond Hettinger added the comment: Sure, I’m happy to wait. My thoughts: * The first link you provided does give the same slope across packages. Where they differ is in how they choose to report statistics for assessing goodness of fit or for informing hypothesis testing. Neither

[issue45780] dict. keys view behaviour diverges from set()

2021-11-10 Thread Raymond Hettinger
Raymond Hettinger added the comment: This is a bug dictviews_sub(). It that incorrectly calls difference_update() instead of set_isub() which would perform the requisite type check. Note the KeysView ABC is correct and implements the type check. This situation is unfortunate. Adding

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

2021-11-10 Thread Raymond Hettinger
Raymond Hettinger added the comment: +1 for reverting this change and restoring the previous behavior. -- ___ Python tracker <https://bugs.python.org/issue43

[issue45235] argparse does not preserve namespace with subparser defaults

2021-11-10 Thread Raymond Hettinger
Raymond Hettinger added the comment: Unless anyone objects, I'll revert this across all affected branches. -- ___ Python tracker <https://bugs.python.org/issue45

[issue45776] abc submodule not an attribute of collections on Python 3.10.0 on Windows

2021-11-10 Thread Raymond Hettinger
Raymond Hettinger added the comment: Also, the collections module could simply delete abc if it already exists due to collections.abc being imported first. -- ___ Python tracker <https://bugs.python.org/issue45

[issue45776] abc submodule not an attribute of collections on Python 3.10.0 on Windows

2021-11-10 Thread Raymond Hettinger
Raymond Hettinger added the comment: > On Mac, collections.abc is imported at startup time > via site.py (which imports rlcompleter, which imports > inspect, which imports collections.abc). In inspect.py, the import of collections.abc is only used inside isawaitable(). We c

[issue45776] abc submodule not an attribute of collections on Python 3.10.0 on Windows

2021-11-10 Thread Raymond Hettinger
Raymond Hettinger added the comment: > this coincides with collection ABCs being made unavailable directly from > `collections` with this 3.9 -> 3.10 version change Direct access from collections was removed after being deprecated for almost almost a decade ago: "Usin

[issue45701] Add tuple tests to `functools.lru_cache`

2021-11-09 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset 912a4ccc3a523e2990cc501393adfc661614c73a by Raymond Hettinger in branch 'main': bpo-45701: Improve documentation for *typed* parameter (GH-29498) https://github.com/python/cpython/commit/912a4ccc3a523e2990cc501393adfc661614c73a

[issue45701] Add tuple tests to `functools.lru_cache`

2021-11-09 Thread Raymond Hettinger
Change by Raymond Hettinger : -- nosy: +rhettinger nosy_count: 1.0 -> 2.0 pull_requests: +27747 pull_request: https://github.com/python/cpython/pull/29498 ___ Python tracker <https://bugs.python.org/issu

[issue45766] Add direct proportion option to statistics.linear_regression()

2021-11-09 Thread Raymond Hettinger
Change by Raymond Hettinger : -- keywords: +patch pull_requests: +27741 stage: -> patch review pull_request: https://github.com/python/cpython/pull/29490 ___ Python tracker <https://bugs.python.org/issu

[issue45766] Add direct proportion option to statistics.linear_regression()

2021-11-09 Thread Raymond Hettinger
New submission from Raymond Hettinger : Signature: def linear_regression(x, y, /, *, proportional=False): Additional docstring with example: If *proportional* is true, the independent variable *x* and the dependent variable *y* are assumed to be directly proportional

[issue45708] PEP 515-style formatting with underscores does not seem to work for Decimal

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

[issue45735] Promise the long-time truth that `args=list` works

2021-11-05 Thread Raymond Hettinger
Change by Raymond Hettinger : -- Removed message: https://bugs.python.org/msg405847 ___ Python tracker <https://bugs.python.org/issue45735> ___ ___ Python-bug

[issue45735] Promise the long-time truth that `args=list` works

2021-11-05 Thread Raymond Hettinger
Change by Raymond Hettinger : -- keywords: +patch pull_requests: +27691 stage: needs patch -> patch review pull_request: https://github.com/python/cpython/pull/29437 ___ Python tracker <https://bugs.python.org/issu

[issue45735] Promise the long-time truth that `args=list` works

2021-11-05 Thread Raymond Hettinger
Raymond Hettinger added the comment: I relied on this for many years. So, yet it would be nice to guarantee it :-) -- nosy: +rhettinger ___ Python tracker <https://bugs.python.org/issue45

[issue45701] Add tuple tests to `functools.lru_cache`

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

[issue45679] typing.Literal[True] is implicitly converted to typing.Literal[1]

2021-11-05 Thread Raymond Hettinger
Raymond Hettinger added the comment: New changeset 60b5333fa936a7e7f078a82e0fa3752cc9b6c5fb by Nikita Sobolev in branch 'main': bpo-45679: add `tuple` tests with `lru_cache` to `test_functools` (GH-29339) https://github.com/python/cpython/commit/60b5333fa936a7e7f078a82e0fa3752cc9b6c5fb

[issue45708] PEP 515-style formatting with underscores does not seem to work for Decimal

2021-11-04 Thread Raymond Hettinger
Change by Raymond Hettinger : -- nosy: +serhiy.storchaka ___ Python tracker <https://bugs.python.org/issue45708> ___ ___ Python-bugs-list mailing list Unsub

[issue45708] PEP 515-style formatting with underscores does not seem to work for Decimal

2021-11-04 Thread Raymond Hettinger
Raymond Hettinger added the comment: Tim, do you have any thoughts on whether Decimal should extend beyond the specification in this case? -- assignee: -> rhettinger nosy: +rhettinger, tim.peters ___ Python tracker <https://bugs.pyth

[issue45466] Simple curl/wget-like download functionality in urllib (like http offers server)

2021-11-01 Thread Raymond Hettinger
Raymond Hettinger added the comment: > If curl/wget are available, great, but often slim images > don't offer that. I concur with Christian. For the most part, the standard library aims to be a collection of resources helpful for building applications like curl and wget. The applic

[issue45670] New .mapping attribute is broken for some existing uses of dict views

2021-10-31 Thread Raymond Hettinger
Raymond Hettinger added the comment: Hmm, I'm looking through the bidict code a bit more. Rather than saying the dict views are being used in an unsupported way, it is more accurate to say that your intended meaning for the *mapping* attribute differs from the published meaning. Note

[issue45670] New .mapping attribute is broken for some existing uses of dict views

2021-10-31 Thread Raymond Hettinger
Raymond Hettinger added the comment: Sorry, but this isn't bug in Python. The documented and supported API is the MappingView ABC where the _mapping attribute is private. As an optimization, the bidict project has elected to forgo the supported API and instead use a concrete implementation

[issue45682] Nicer default logging format

2021-10-31 Thread Raymond Hettinger
Raymond Hettinger added the comment: Generally, we can't change defaults after an API has been published because it immediately affects the output for people who use that default. However in the case of logging, an argument could be made that changing the default would have less impact

[issue45588] cached_method similar to cached_property to cache with classes

2021-10-25 Thread Raymond Hettinger
Raymond Hettinger added the comment: > The lru_cache can trigger infinite recursion if it is used > to cache a hash computation because the cache look-up itself > requires the hash. Yes, I see the problem. Am not sure whether I should add a note to the docs for this. > T

[issue45599] Please official support %G, %V and %u directives in time library

2021-10-24 Thread Raymond Hettinger
Change by Raymond Hettinger : -- versions: -Python 3.10, Python 3.6, Python 3.7, Python 3.8, Python 3.9 ___ Python tracker <https://bugs.python.org/issue45

[issue45588] cached_method similar to cached_property to cache with classes

2021-10-24 Thread Raymond Hettinger
Raymond Hettinger added the comment: > In my use case, the objects hold references to large blocks > of GPU memory that should be freed as soon as possible. That makes sense. I can see why you reached for weak references. Would it be a workable alternative to have an explicit

[issue45588] cached_method similar to cached_property to cache with classes

2021-10-24 Thread Raymond Hettinger
Raymond Hettinger added the comment: For comparison, here is a recipe that I was originally going to include in the FAQ entry but later decided against it. It only had an advantage over @lru_cache with instances so large that we can't wait for them to age out of the cache. It shouldn't

[issue45579] [list.append(i) for i in list] causes high resources usage

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

[issue45588] cached_method similar to cached_property to cache with classes

2021-10-23 Thread Raymond Hettinger
Raymond Hettinger added the comment: See also: https://docs.python.org/3/faq/programming.html#how-do-i-cache-method-calls -- ___ Python tracker <https://bugs.python.org/issue45

[issue45588] cached_method similar to cached_property to cache with classes

2021-10-23 Thread Raymond Hettinger
Raymond Hettinger added the comment: AFAICT, the only capability added by the PR is keeping a weak reference to the instance. This doesn't improve the hit rate and will make the hit rate worse for instances that define __hash__. In the PR's example, two vector instances with equal

<    1   2   3   4   5   6   7   8   9   10   >