[issue27933] functools.lru_cache seems to not work when renaming decorated functions

2016-09-01 Thread Steven D'Aprano
Steven D'Aprano added the comment: In case it isn't obvious, my example is meant to be pseudo-code, not the exact implementation used. -- ___ Python tracker <http://bugs.python.o

[issue27942] Default value identity regression

2016-09-02 Thread Steven D'Aprano
Steven D'Aprano added the comment: Can confirm the expected behaviour (printing True) in Python 2.4 through 2.7, 3.3, Jython 2.5, and even venerable old Python 1.5 (where it prints 1). But *not* IronPython 2.6, where it prints False. In 3.6, the difference seems to be here:

[issue27964] Add random.shuffled

2016-09-05 Thread Steven D'Aprano
New submission from Steven D'Aprano: An occasionally requested feature is for a shuffled() function, related to the in-place random.shuffle() as sorted() is to list.sort(). See the latest example: https://mail.python.org/pipermail/python-ideas/2016-September/042096.html -- mes

[issue27975] math.isnan(int) and math.isinf(int) should not raise OverflowError

2016-09-06 Thread Steven D'Aprano
New submission from Steven D'Aprano: Currently, math.isnan(n) and math.isinf(n) for n an int may raise OverflowError if n is too big to convert to a float, e.g.: py> math.isnan(10**1) Traceback (most recent call last): File "", line 1, in OverflowError: int too large t

[issue27975] math.isnan(int) and math.isinf(int) should not raise OverflowError

2016-09-06 Thread Steven D'Aprano
Steven D'Aprano added the comment: As a convenience for whom? Certainly not the poor user, who thinks that math.isnan(x) should return False if the number x is not a NAN. Since neither 10**1 nor 10**10 are NANs, why should one return correctly and the other raise a completely spu

[issue27975] math.isnan(int) and math.isinf(int) should not raise OverflowError

2016-09-06 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Tue, Sep 06, 2016 at 05:59:08PM +, Mark Dickinson wrote: > Why do you single out `int` for special treatment, Mostly as a demonstration for what could be done, not necessarily as what should be done. Secondly as a potential optimization. Why g

[issue28021] Calculating wrong modulus manually

2016-09-08 Thread Steven D'Aprano
Steven D'Aprano added the comment: That is because of floating point rounding. When you calculate a/23, the result is the approximate float 2.659090889061502e+18 instead of the exact integer result 2659090889061502012. Converting to an int gives you a result which is too small: py>

[issue27181] Add geometric mean to `statistics` module

2016-09-11 Thread Steven D'Aprano
Steven D'Aprano added the comment: As discussed with Ned by email, I'm currently unable to build 3.6 and won't have time to work on this before b1. As discussed on #27761 my tests here are too strict and should be loosened, e.g. from assertEqual to assertAlmostEqual. Ned wrot

[issue27761] Private _nth_root function loses accuracy

2016-09-11 Thread Steven D'Aprano
Steven D'Aprano added the comment: As discussed with Ned via email, this issue shouldn't affect the public geometric_function and the failing tests (currently skipped) are too strict. The existing tests demand an unrealistic precision which should be loosened, e.g. from asse

[issue28092] Build failure for 3.6 on Centos 5.11

2016-09-11 Thread Steven D'Aprano
New submission from Steven D'Aprano: On Centos 5.11, building fails with: Python/dtrace_stubs.o: In function `PyDTrace_LINE': /home/steve/python/python-dev/cpython/Include/pydtrace.h:28: multiple definition of `PyDTrace_LINE' Python/ceval.o:/home/steve/python/python-dev/

[issue28092] Build failure for 3.6 on Centos 5.11

2016-09-12 Thread Steven D'Aprano
Steven D'Aprano added the comment: Ned, I know my system is old so I understand if 3.6 no longer supports gcc 4.1. Tell me what minimum version I should use (4.8?) and I'll find a way to upgrade or use another system. Shouldn't the build system explicitly report that the compi

[issue28111] geometric_mean can raise OverflowError when checking for inf

2016-09-12 Thread Steven D'Aprano
New submission from Steven D'Aprano: >>> statistics.geometric_mean([0.7 for _ in range(5000)]) Traceback (most recent call last): File "/Users/mdickinson/Python/cpython-git/Lib/statistics.py", line 362, in float_nroot isinfinity = math.isinf(x) OverflowError: int

[issue27181] Add geometric mean to `statistics` module

2016-09-12 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Mon, Sep 12, 2016 at 03:35:14PM +, Mark Dickinson wrote: > statistics.geometric_mean(0.7 for _ in range(5000)) I've raised a new ticket #28111 -- ___ Python tracker <http://bugs.pytho

[issue28171] getopt.getopt error processing long_options

2016-09-15 Thread Steven D'Aprano
Steven D'Aprano added the comment: > Surely this isn't intended behavior (?) It is indeed. That's standard behaviour for GNU getopt, which the Python module is modelled after: [steve@ando ~]$ getopt --version getopt (enhanced) 1.1.4 [steve@ando ~]$ getopt --versi getop

[issue28171] getopt.getopt error processing long_options

2016-09-15 Thread Steven D'Aprano
Steven D'Aprano added the comment: > How is silently failing to resolve input errors okay ? You haven't demonstrated that it fails to resolve input errors. You have demonstrated a *feature*, not a bug: getopt will accept prefixes if they unambiguously match ONE long option only.

[issue28171] getopt.getopt error processing long_options

2016-09-15 Thread Steven D'Aprano
Steven D'Aprano added the comment: > argparse here I come! https://docs.python.org/2/library/argparse.html#argument-abbreviations-prefix-matching Prefix matching is a standard feature of all command line option parsers that I

[issue28205] Add optional suffix to str.join

2016-09-19 Thread Steven D'Aprano
New submission from Steven D'Aprano: It is moderately common to want to join a sequence of substrings with a delimiter rather than a separator, e.g. when joining a sequence of lines into a single string, you usually want a trailing newline as well as newlines between the lines. E.g.:

[issue28205] Add optional suffix to str.join

2016-09-19 Thread Steven D'Aprano
Steven D'Aprano added the comment: > lines = ''.join(substring + '\n' for substring in substrings) Huh. There were three of us looking at this at work yesterday, and none of us thought of that. -- ___ Python trac

[issue28240] Enhance the timeit module

2016-09-21 Thread Steven D'Aprano
Steven D'Aprano added the comment: > * Display the average, rather than the minimum, of the timings *and* > display the standard deviation. It should help a little bit to get > more reproductible results. I'm still not convinced that the average is the right statistic to

[issue28240] Enhance the timeit module: display average +- std dev instead of minimum

2016-09-21 Thread Steven D'Aprano
Steven D'Aprano added the comment: > I'd suggest to display all values and base the findings on > all available values, rather than just one: > min, max, avg, median, stddev. If we're going to go down that path, I suggest using something like: https://en.wikipedia.org/

[issue28205] Add optional suffix to str.join

2016-09-22 Thread Steven D'Aprano
Steven D'Aprano added the comment: > Looking again at the comments for the other respondents, I think this > should just be closed. It doesn't make sense to disturb a long > standing API or the break the join/split symmetry. For what it's worth, in hindsight I agree.

[issue28328] statistics.geometric_mean has no tests. Defer to 3.7?

2016-10-01 Thread Steven D'Aprano
Steven D'Aprano added the comment: Unfortunately I'm in a pickle at the moment, I cannot build 3.6 on any of the machines I have available (three), and no time to upgrade them to something that will build 3.6. But I can provide some tests, if somebody is willing to review and check

[issue28327] statistics.geometric_mean gives incorrect results for mixed int/float inputs

2016-10-01 Thread Steven D'Aprano
Steven D'Aprano added the comment: Looks good for me. Thanks for catching this: I knew it was a bug, but then I ran into the issue that I could no longer build 3.6 before I could fix it, and between that and various issues in the real world I never got back to

[issue28328] statistics.geometric_mean has no tests. Defer to 3.7?

2016-10-01 Thread Steven D'Aprano
Steven D'Aprano added the comment: > The newly-added statistics.geometric_mean function appears to have no > tests at all That's weird and unfortunate. I certainly wrote tests, and I have a backup of them. I have no idea what happened. Attached is a patch that adds the tests,

[issue28328] statistics.geometric_mean has no tests. Defer to 3.7?

2016-10-04 Thread Steven D'Aprano
Steven D'Aprano added the comment: > Steve, I really think we should postpone to 3.7. [...] If these fixes have to be in by the next beta (10th Oct), I fear that you are right. I can build up to changeset 103135:8b74e5528f35, but not beyond. I will be able to rectify that, but reali

[issue27181] Add geometric mean to `statistics` module

2016-10-04 Thread Steven D'Aprano
Steven D'Aprano added the comment: I'm sorry to say that due to technical difficulties, geometric mean is not going to be in a fit state for beta 2 of 3.6, and so is going to be removed and delayed until 3.7. -- priority: release blocker -> versions: +Python 3.

[issue28351] statistics.geometric_mean can enter infinite loop for Decimal inputs

2016-10-04 Thread Steven D'Aprano
Changes by Steven D'Aprano : -- versions: -Python 3.6 ___ Python tracker <http://bugs.python.org/issue28351> ___ ___ Python-bugs-list mailing list Unsubscr

[issue28328] statistics.geometric_mean has no tests. Defer to 3.7?

2016-10-04 Thread Steven D'Aprano
Changes by Steven D'Aprano : -- versions: -Python 3.6 ___ Python tracker <http://bugs.python.org/issue28328> ___ ___ Python-bugs-list mailing list Unsubscr

[issue28327] statistics.geometric_mean gives incorrect results for mixed int/float inputs

2016-10-04 Thread Steven D'Aprano
Changes by Steven D'Aprano : -- versions: -Python 3.6 ___ Python tracker <http://bugs.python.org/issue28327> ___ ___ Python-bugs-list mailing list Unsubscr

[issue28111] geometric_mean can raise OverflowError for large input length

2016-10-04 Thread Steven D'Aprano
Changes by Steven D'Aprano : -- versions: -Python 3.6 ___ Python tracker <http://bugs.python.org/issue28111> ___ ___ Python-bugs-list mailing list Unsubscr

[issue27761] Private _nth_root function loses accuracy

2016-10-04 Thread Steven D'Aprano
Changes by Steven D'Aprano : -- versions: +Python 3.7 -Python 3.6 ___ Python tracker <http://bugs.python.org/issue27761> ___ ___ Python-bugs-list m

[issue28366] Syntax issue

2016-10-05 Thread Steven D'Aprano
New submission from Steven D'Aprano: Did you take a picture of the screen with your iPhone? Why didn't you take a screenshot? Or better still, since this is a text-based medium not a graphics error, copy and paste the text involved? That's easier for people to work with, incl

[issue28365] 3.5.2 syntax issue

2016-10-05 Thread Steven D'Aprano
Steven D'Aprano added the comment: See #28366 -- nosy: +steven.daprano ___ Python tracker <http://bugs.python.org/issue28365> ___ ___ Python-bugs-list m

[issue28366] Syntax issue

2016-10-05 Thread Steven D'Aprano
Changes by Steven D'Aprano : -- components: +Windows nosy: +paul.moore, steve.dower, tim.golden, zach.ware versions: +Python 3.5 ___ Python tracker <http://bugs.python.org/is

[issue28365] 3.5.2 syntax issue

2016-10-05 Thread Steven D'Aprano
Changes by Steven D'Aprano : -- nosy: +terry.reedy ___ Python tracker <http://bugs.python.org/issue28365> ___ ___ Python-bugs-list mailing list Unsubscr

[issue28381] Add a "starcaller" function

2016-10-06 Thread Steven D'Aprano
Steven D'Aprano added the comment: This was discussed on Python-Ideas back in July: https://mail.python.org/pipermail/python-ideas/2016-July/041153.html I don't recall any opposition, although Nick suggested that possibly a better idea was to resurrect the `apply` built-in into

[issue27495] Pretty printing sorting for set and frozenset instances

2016-10-25 Thread Steven D'Aprano
Steven D'Aprano added the comment: There seems to be consensus that this should be treated as a bug fix, not a new feature. Could this still make it into 3.6 even though it missed the first beta? -- nosy: +steven.daprano ___ Python tracker

[issue28535] round seems to provide floor, not proper rounding

2016-10-25 Thread Steven D'Aprano
Steven D'Aprano added the comment: To be clear, let's look at the first failed assertion: AssertionError: 32.78 != 32.775 within 2 places It sure *looks* like 32.775 ought to round to 32.78. And indeed it would, if it actually was 32.775. But despite appearances, it isn't. S

[issue24379] Add operator.subscript as a convenience for creating slices

2016-11-12 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Sat, Nov 12, 2016 at 08:23:45AM +, Raymond Hettinger wrote: > I can't even dream up any scenarios where > ``operator.subscript[3:7:2]`` would be better than > ``slice(3, 7, 2)``. For that specific example, I completely agree.

[issue28681] About function renaming in the tutorial

2016-11-12 Thread Steven D'Aprano
Steven D'Aprano added the comment: I disagree that "aliasing" is more accurate. We have a perfectly good name for symbols in Python: "name". A value (and that includes functions) can have multiple names. It seems to me that if we're to start distinguishing b

[issue28681] About function renaming in the tutorial

2016-11-13 Thread Steven D'Aprano
Steven D'Aprano added the comment: > And this is aliasing: > g = f Is it only aliasing if you know that f is a function? I don't mean that as a rhetorical question -- I'm asking if we're comfortable with the idea of saying that g is an ali

[issue28745] Python 3.5.2 "from ... import" statement is different from official documentation

2016-11-18 Thread Steven D'Aprano
Steven D'Aprano added the comment: Please don't post screen shots of text. Copy and paste the text into the bug report. Some people (those who are blind, visually impaired or using a screen-reader for some other reason) cannot see the screen shot, and even those who can prefer to

[issue28745] Python 3.5.2 "from ... import" statement is different from official documentation

2016-11-18 Thread Steven D'Aprano
Steven D'Aprano added the comment: If you're quoting from the docs, its a good idea to give the URL to *which* documentation you are reading, not just a copy of the text. -- ___ Python tracker <http://bugs.python.o

<    10   11   12   13   14   15