[issue25709] greek alphabet bug it is very disturbing...

2015-11-23 Thread Steven D'Aprano
Steven D'Aprano added the comment: I'm afraid I'm unable to replicate this bug report in Python 3.4. If you are able to replicate it, can you tell us the exact version number of Python you are using? Also, which operating system are you using? -- nosy: +steven.daprano

[issue27181] Add geometric mean to `statistics` module

2016-06-02 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Thu, Jun 02, 2016 at 09:04:54PM +, Raymond Hettinger wrote: > Steven, this seems like a reasonable suggestion (though I would expect > someone else will immediately suggest a harmonic mean as well). Is > this within the scope of what you we

[issue27234] tuple - single value with comma is assigned as type tuple

2016-06-05 Thread Steven D'Aprano
Steven D'Aprano added the comment: Yes, it is intended. Commas create tuples, not parentheses. (With the exception of the empty tuple.) The parens are just for grouping and precedence. `1,` is a tuple, regardless of whether you use parens around it or not. -- nosy: +steven.daprano

[issue27181] Add geometric mean to `statistics` module

2016-06-09 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Thu, Jun 09, 2016 at 09:24:04AM +, Mark Dickinson wrote: > On the other hand, apparently `exp(mean(log(...)))` is good enough for SciPy: Hmm, well, I don't have SciPy installed, but I've found that despite their (well-deserved) reputation, nu

[issue27293] Summarize issues related to urandom, getrandom etc in secrets documentation

2016-06-11 Thread Steven D'Aprano
New submission from Steven D'Aprano: Write some documentation for the ``secrets`` module summarizing the issues relating to /dev/[u]random, getrandom, etc. There's a lot of confusion about these issues, and the web contains a lot of misinformation, so being able to point to the secrets docs

[issue27292] Warn users that os.urandom() can return insecure values

2016-06-11 Thread Steven D'Aprano
Steven D'Aprano added the comment: Relevant: issue #27293 (I've taken the liberty of subscribing those on this issues nosy list to the new issue, I hope that's okay) -- nosy: +steven.daprano ___ Python tracker <rep...@bugs.python.org>

[issue27288] secrets should use getrandom() on Linux

2016-06-11 Thread Steven D'Aprano
Steven D'Aprano added the comment: I don't want to start another huge thread on python-dev unless really necessary. What should happen to random.SystemRandom? (1) nothing, it stays as it is, and if ``secrets`` needs better, it can subclass it; (2) it changes to use ``os.getrandom

[issue27228] just for clearing: os.path.normpath("file://a") returns "file:/a"

2016-06-05 Thread Steven D'Aprano
Steven D'Aprano added the comment: "file://a" is a valid relative file path, for a directory called "file:" and a file called "a", so normpath should return "file:/a". -- nosy: +steven.daprano ___ Pytho

[issue27176] Addition of assertNotRaises

2016-06-01 Thread Steven D'Aprano
Steven D'Aprano added the comment: Yes. What does such an assertion actually mean? Why would I write `self.assertNotRaises(ValueError, spam, arg)` rather than just call `spam(arg)`? The only difference is that assertNotRaises will treat one specific exception as a test failure rather than

[issue27157] Unhelpful error message when one calls a subclass of type with a custom metaclass

2016-05-29 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Mon, May 30, 2016 at 01:43:22AM +, ppperry wrote: > steven.daprano, you don't appear to have properly read the issue > comments. Ack; I saw your comment about the metaclass, then saw your retraction of the metaclass issue, then misinterprete

[issue27157] Unhelpful error message when one calls a subclass of type with a custom metaclass

2016-05-29 Thread Steven D'Aprano
Steven D'Aprano added the comment: I am unable to replicate this in Python 2.7, 3.3 or 3.6. I haven't bothered to test against other versions, because I think that this is a PyShell issue, not a Python issue. (I think you are using PyShell, based on the traceback given.) Before reporting bugs

[issue27362] json.dumps to check for obj.__json__ before raising TypeError

2016-06-21 Thread Steven D'Aprano
Steven D'Aprano added the comment: For starters, dunder names like __json__ are reserved for Python's own use, so you would have to get the core developers to officially bless this use. But... I'm not really sure that "the responsibility of determining how an object should be repres

[issue27353] Add nroot function to math

2016-06-20 Thread Steven D'Aprano
Steven D'Aprano added the comment: I suggested on python-ideas that the math module be given a pure-Python front end. Guido wasn't too keen on that idea, so I won't push for it. He did agree that having nroot in math was a reasonable idea. If I attach a pure Python implementation and tests

[issue27139] Increased test coverage for statistics.median_grouped

2016-06-16 Thread Steven D'Aprano
Steven D'Aprano added the comment: Thanks Julio, I hope to get to this over the next week. Please feel free to prod me if you see no action by then. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue27335] Clarify that writing to locals() inside a class body is supported

2016-06-16 Thread Steven D'Aprano
New submission from Steven D'Aprano: The docs for locals() warn not to write to the dict returned, as it may not have the intended effect of modifying the actual variables seen by the interpreter. https://docs.python.org/3/library/functions.html#locals But as I understanding it, using locals

[issue26118] String performance issue using single quotes

2016-01-15 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Fri, Jan 15, 2016 at 07:56:39AM +, poostenr wrote: > As I did more testing I noticed that appending data to the file slowed > down. The file grew initially with ~30-50KB increments and around > 500KB it had slowed down to ~3-5KB/s, until a

[issue26118] String performance issue using single quotes

2016-01-14 Thread Steven D'Aprano
Steven D'Aprano added the comment: I cannot replicate that performance difference under Linux. There's a small difference (about 0.1 second per million iterations, or a tenth of a microsecond) on my computer, but I don't think that's meaningful: py> from timeit import Timer py&

[issue27353] Add nroot function to math

2016-06-25 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Mon, Jun 20, 2016 at 09:02:09PM +, Tim Peters wrote: > Note that the very popular TI graphics calculators have had a distinct > nth-root function at least since the TI-83. It's a minor convenience > there. Likewise HP calculator

[issue26337] Bypass imghdr module determines the type of image

2016-02-11 Thread Steven D'Aprano
Steven D'Aprano added the comment: I'm sorry, I don't understand what you think is the bug here. It looks like you are passing a corrupted file which has a PNG extension but is not actually a PNG file (it contains PHP code). What do you expect should happen? -- nosy: +steven.daprano

[issue26086] Bug in os module

2016-02-11 Thread Steven D'Aprano
Steven D'Aprano added the comment: I don't see any conclusive evidence that this is a bug in the Python interpreter, so I'm going to close the issue. Hana, if you are still having this problem, please join the main python mailing list https://mail.python.org/mailman/listinfo/python-list

[issue26351] Occasionally check for Ctrl-C in long-running operations like sum

2016-02-12 Thread Steven D'Aprano
New submission from Steven D'Aprano: There are a few operations such as summing or unpacking infinite iterators where the interpreter can become unresponsive and ignore Ctrl-C KeyboardInterrupt. Guido suggests that such places should occasionally check for signals: https://mail.python.org

[issue26214] textwrap should minimize number of breaks in extra long words

2016-02-11 Thread Steven D'Aprano
Changes by Steven D'Aprano <steve+pyt...@pearwood.info>: -- nosy: +steven.daprano ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue26002] make statistics.median_grouped more efficient

2016-02-11 Thread Steven D'Aprano
Steven D'Aprano added the comment: Looks good to me. I've run some quick timing tests, and for very small lists, there's no significant difference, but for larger lists I'm getting up to a 50% speedup. Nicely done, thank you. -- ___ Python tracker

[issue26361] lambda in dict comprehension is broken

2016-02-14 Thread Steven D'Aprano
Steven D'Aprano added the comment: This is the standard behaviour of closures in Python. It's annoying, and often not what you expect, but it's not a bug. Effectively, your dict or list contains five functions, each of which refer to the same variable "t". By the time the loo

[issue26369] doc for unicode.decode and str.encode is unnecessarily confusing

2016-02-16 Thread Steven D'Aprano
Steven D'Aprano added the comment: Perhaps you could suggest a specific change to the docstrings for str.encode and unicode.decode? (BTW, I presume you are aware that the equivalent of (bytes)str.encode and unicode.decode are gone in Python 3?) -- nosy: +steven.daprano

[issue26597] Document how to cite Python

2016-03-20 Thread Steven D'Aprano
New submission from Steven D'Aprano: Add either a FAQ or a new page under "Meta Information" in the documentation for how to formally cite Python in scientific papers or other academic situations. See thread on Python-Ideas here for justification and further discussi

[issue26596] numpy.all np.all .all

2016-03-20 Thread Steven D'Aprano
Steven D'Aprano added the comment: This is not a bug, but behaving correctly. You have: py> A = np.random.random((10,1)) py> np.all(A) True py> np.all(A) < 1 # is True less than 1? False which is correct: True is *not* less than 1. But True *is* less than 2: py> True < 2

[issue26490] Leading “0” allowed, only for decimal zero

2016-03-05 Thread Steven D'Aprano
Steven D'Aprano added the comment: This was raised and rejected here: http://bugs.python.org/issue24668 -- nosy: +steven.daprano ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue26694] Disasembler fall with Key Error while disassemble obfuscated code.

2016-04-05 Thread Steven D'Aprano
Changes by Steven D'Aprano <steve+pyt...@pearwood.info>: -- nosy: +steven.daprano ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue26878] Allow doctest to deep copy globals

2016-04-29 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Fri, Apr 29, 2016 at 10:09:46AM +, DqASe wrote: > Added file: http://bugs.python.org/file42649/x.py Ah, I see! That makes sense now. Thanks. Why don't you just set the initial state of the lists in the doctests? That makes much better documentat

[issue26878] Allow doctest to deep copy globals

2016-04-28 Thread Steven D'Aprano
Steven D'Aprano added the comment: I'm afraid I can't quite see what the problem is. If you're passing your own globs argument, can't you deepcopy it yourself? Could you show a minimal, short example demonstrating the issue please? -- nosy: +steven.daprano versions: +Python 3.6

[issue26369] unicode.decode and str.encode are unnecessarily confusing for non-ascii

2016-05-19 Thread Steven D'Aprano
Steven D'Aprano added the comment: Ben, I'm sorry to see you have spent such a long time writing up reasons for changing this behaviour. I fear this is a total waste of your time, and ours to read it. Python 2.7 is under feature freeze, and changing the behaviour of str.encode

[issue27090] Python 3 import error after installation

2016-05-23 Thread Steven D'Aprano
Steven D'Aprano added the comment: It looks like your Python 3 is somehow using your Python 2 site directory. What does your PYTHONPATH contain? Try running this: python3 -E -S -c "import sys; print(sys.path)" and see what it says. -- nosy: +steven.daprano type: crash -

[issue6422] timeit called from within Python should allow autoranging

2016-05-11 Thread Steven D'Aprano
Steven D'Aprano added the comment: This issue seems to have lost momentum, I'd like to revive it by proposing a slightly different interface for the autorange function. Attached is a proof-of-concept patch. I've moved the code which determines the number of loops out of the main function

[issue6422] timeit called from within Python should allow autoranging

2016-05-11 Thread Steven D'Aprano
Steven D'Aprano added the comment: > I would suggest making the 0.2 tunable as an optional argument. Sounds like a good idea to me. > I also notice the repeat functionality isn't included in the patch, is there > a reason? I don't understand which repeat functionality you're

[issue26996] Add secrets module as per PEP 506.

2016-05-10 Thread Steven D'Aprano
New submission from Steven D'Aprano: (This is already done, but I should have added a ticket before committing the new module.) See PEP-0506. -- assignee: steven.daprano components: Library (Lib) messages: 265288 nosy: steven.daprano priority: normal severity: normal status: open

[issue26996] Add secrets module as per PEP 506.

2016-05-10 Thread Steven D'Aprano
Changes by Steven D'Aprano <steve+pyt...@pearwood.info>: -- resolution: -> fixed stage: -> resolved status: open -> closed ___ Python tracker <rep...@bugs.python.org> <http://bu

[issue6422] timeit called from within Python should allow autoranging

2016-05-12 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Thu, May 12, 2016 at 04:49:59AM +, Nick Coghlan wrote: > The embedded side-effects were my main concern with Scott's original > patch, so Steven's callback-based approach strikes me as a definite > improvement. However, the awkwardness of th

[issue27023] Documentation of tempfile.gettempdir() does not mention it only supports existing directories

2016-05-14 Thread Steven D'Aprano
Steven D'Aprano added the comment: I don't understand. The documentation clearly states: "Python searches a standard list of directories to find one which the calling user can create files in." How do you expect to be able to write files to a directory that doesn't exist? -

[issue27017] Python3.5.1: type().startswith()

2016-05-14 Thread Steven D'Aprano
Steven D'Aprano added the comment: To explain in more detail: ``type('s').startswith`` is the same as ``str.startswith``, which is an unbound method in Python 2 and a regular function in Python 3. Either way, it expects *two* arguments: a string which becomes "self", and a sec

[issue26002] make statistics.median_grouped more efficient

2016-05-04 Thread Steven D'Aprano
Changes by Steven D'Aprano <steve+pyt...@pearwood.info>: -- stage: patch review -> commit review ___ Python tracker <rep...@bugs.python.org> <http://bugs.pyt

[issue26954] Add Guido's rejection notice to the "with" FAQ

2016-05-04 Thread Steven D'Aprano
New submission from Steven D'Aprano: The FAQs include a discussion of the rejected Pascal "with" statement (different from the Python `with`). From time to time people propose variants of it, such as using a leading dot to make it unambiguous. Guido has just firmly rejected

[issue26951] Unintuitive error when using generator expression in class property

2016-05-04 Thread Steven D'Aprano
Steven D'Aprano added the comment: On snap! Nicely found! This seems to have something to do with the way generator expressions are run inside their own scope. In Python 2.7, a list comprehension in a class sees the locals correctly: py> class K: ... a = 2; x = [a+i for i in ra

[issue26947] Documentation improvement needed

2016-05-04 Thread Steven D'Aprano
Steven D'Aprano added the comment: Xiang Zhang is correct: the original is technically correct. If you read it like this: "All of Python’s immutable built-in objects are hashable, while no mutable containers (such as lists or dictionaries) are [hashable]." it should be clear. But i

[issue26977] Unnecessary line in statistics.pvariance

2016-05-08 Thread Steven D'Aprano
Steven D'Aprano added the comment: Thanks Ian! I can't believe I looked at that function earlier today and couldn't see that! -- nosy: +steven.daprano stage: -> resolved status: open -> closed ___ Python tracker <rep...@bugs.python.o

[issue26973] Dict View binops permit non-set types

2016-05-08 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Sun, May 08, 2016 at 04:24:59AM +, Joshua Morton wrote: > Following the comments in python ideas [1] [...] > > [1] https://mail.python.org/pipermail/python-ideas/2016-April/039469.html Am I missing something? I don't see anything r

[issue27124] binascii.a2b_hex raises binascii.Error and ValueError, not TypeError

2016-05-25 Thread Steven D'Aprano
Steven D'Aprano added the comment: In Python 3.x, 'a' is just as much a Unicode string as 'ä'. I agree that binascii.a2b_hex should raise ValueError for argument 'ä', or ';' for that matter, as they are invalid values. There's an inconsistency in why some invalid characters raise ValueError

[issue27619] getopt should strip whitespace from long arguments

2016-07-25 Thread Steven D'Aprano
Steven D'Aprano added the comment: Thanks for the quick review, I've fixed the issues you mentioned. -- Added file: http://bugs.python.org/file43886/getopt.patch ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue27619] getopt should strip whitespace from long arguments

2016-07-25 Thread Steven D'Aprano
New submission from Steven D'Aprano: As reported here: https://mail.python.org/pipermail/python-list/2016-July/711333.html there's a possible annoyance with getopt when you accidentally leave whitespace on a long option. On my Centos system, getopt ignores leading and trailing whitespace

[issue27619] getopt should strip whitespace from long arguments

2016-07-25 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Tue, Jul 26, 2016 at 04:50:33AM +, Serhiy Storchaka wrote: > My answer: if you don't want a space in your long_option, don't put a > space in there. There is no a bug in Python, That's why I listed it as an enhancement, not a bug. > and

[issue27605] Inconsistent calls to __eq__ from built-in __contains__

2016-07-24 Thread Steven D'Aprano
Steven D'Aprano added the comment: I'm reluctant to call this a behaviour bug, because I'm reluctant to guarantee the *precise* behaviour when the classes are different. I haven't checked the source of dict.__contains__, but by experimentation it seems that: needle in {key: value} calls

[issue27619] getopt should strip whitespace from long arguments

2016-07-26 Thread Steven D'Aprano
Steven D'Aprano added the comment: Serhiy Storchaka added the comment: > It makes Python getopt behave less like the C getopt. Exactly! If C getopt allows whitespace in long options, it's a GOOD thing to avoid such a poor design. Who would want a option --foo (note the trailing sp

[issue27621] incorrectly works in IDLE Query dialogs

2016-07-26 Thread Steven D'Aprano
Steven D'Aprano added the comment: I expect that ESC should always cancel, and RETURN/ENTER should always accepts (OK or Save or whatever the "main" button is) regardless of where the focus is. If you want a keyboard shortcut to push the button with focus, use SPACE,

[issue27619] getopt should strip whitespace from long arguments

2016-07-26 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Tue, Jul 26, 2016 at 03:27:29PM +, R. David Murray wrote: [...] > getopt is explicitly emulating the C getopt There are lots of differences between the C getopt and the Python version, and the Python version is described as offering an API "

[issue27739] add math.sign/signum

2016-08-11 Thread Steven D'Aprano
Steven D'Aprano added the comment: If this is added, should this signum function be the two value version that returns 1 for zero, or the three value version that returns 0? Should it distinguish between signed zeroes +0.0 and -0.0? What should it do for NANs (raise, return a NAN, copy

[issue27757] eval() does not allow import statements to run.

2016-08-13 Thread Steven D'Aprano
Steven D'Aprano added the comment: That is not a bug, it is a feature. `eval` only evaluates *expressions*, not statements, and `import` is a statement. Neither of those is going to change. Starting in Python 3.1, you could use `import_module`: https://docs.python.org/3/library/importlib.html

[issue27757] eval() does not allow import statements to run.

2016-08-13 Thread Steven D'Aprano
Steven D'Aprano added the comment: Correction: `importlib.import_module` is also available in Python 2.7. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue27181] Add geometric mean to `statistics` module

2016-08-13 Thread Steven D'Aprano
Steven D'Aprano added the comment: I've created a new issue to track the loss of accuracy on PowerPC: http://bugs.python.org/issue27761 -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue27761] Private _nth_root function loses accuracy

2016-08-14 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Sun, Aug 14, 2016 at 08:29:39AM +, Mark Dickinson wrote: > Steven: can you explain why you think your code *should* be giving > exact results for exact powers? Do you have an error analysis that > says that should be the case? No error analy

[issue27761] Private _nth_root function loses accuracy on PowerPC

2016-08-13 Thread Steven D'Aprano
New submission from Steven D'Aprano: First reported by Martin Panter here: http://bugs.python.org/issue27181#msg272488 I'm afraid I don't know enough about PowerPC to suggest a fix other than weakening the test on that platform. -- assignee: steven.daprano messages: 272638 nosy

[issue27761] Private _nth_root function loses accuracy on PowerPC

2016-08-13 Thread Steven D'Aprano
Steven D'Aprano added the comment: Tests fail on a Power PC buildbot: http://buildbot.python.org/all/builders/PPC64LE%20Fedora%203.x/builds/1476/steps/test/logs/stdio == FAIL: testExactPowers (test.test_statistics.Test_Nth_Root

[issue27761] Private _nth_root function loses accuracy

2016-08-14 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Sun, Aug 14, 2016 at 10:52:42AM +, Mark Dickinson wrote: > Same deal here: those aren't the actual errors; they're approximations > to the errors, since the computations of the epsilons depends on (a) > the usual floating-point rounding,

[issue27761] Private _nth_root function loses accuracy

2016-08-14 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Sun, Aug 14, 2016 at 12:05:37PM +, Mark Dickinson wrote: > But I don't think there's a real problem here so long as you don't > have an expectation of getting super-accurate (e.g., correctly rounded > or faithfully rounded) results

[issue6422] timeit called from within Python should allow autoranging

2016-08-14 Thread Steven D'Aprano
Steven D'Aprano added the comment: Still to do (coming soon): - make the 0.2s time configurable; - have `timeit` and `repeat` methods (and functions) fall back on `autorange` if the number is set to 0 or None. -- assignee: -> steven.dapr

[issue27573] code.interact() should print an exit message

2016-08-14 Thread Steven D'Aprano
Changes by Steven D'Aprano <steve+pyt...@pearwood.info>: -- resolution: -> fixed stage: -> resolved status: open -> closed ___ Python tracker <rep...@bugs.python.org> <http://bu

[issue27181] Add geometric mean to `statistics` module

2016-08-12 Thread Steven D'Aprano
Steven D'Aprano added the comment: I thought about special-casing n=2 to math.sqrt, but as that's an implementation detail I can make that change at any time. According to my testing, math.pow(x, 0.5) is no worse than sqrt, so I'm not sure if there's any advantage to having yet another branch

[issue27573] code.interact() should print an exit message

2016-07-19 Thread Steven D'Aprano
Changes by Steven D'Aprano <steve+pyt...@pearwood.info>: Removed file: http://bugs.python.org/file43791/code.patch ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue27573] code.interact() should print an exit message

2016-07-19 Thread Steven D'Aprano
New submission from Steven D'Aprano: Way too often I've lost track of whether I'm in the code.interact() REPL or the original REPL, or hit Ctrl-D once too often, and accidentally quit the real REPL. It is easy to lose track, since the real and imitation REPL both use the same prompts

[issue27573] code.interact() should print an exit message

2016-07-19 Thread Steven D'Aprano
Steven D'Aprano added the comment: This time, with a patch that includes updated tests. -- Added file: http://bugs.python.org/file43793/code.patch ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue27561] Warn against subclassing builtins, and overriding their methods

2016-07-19 Thread Steven D'Aprano
Steven D'Aprano added the comment: Raymond, that was a fantastic explanation. Would you be willing to turn it into a FAQ? Or if you don't have the time, to allow somebody to steal your description and use it? -- nosy: +steven.daprano ___ Python

[issue27458] Allow subtypes of unicode/str to hit the optimized unicode_concatenate block

2016-07-05 Thread Steven D'Aprano
Steven D'Aprano added the comment: I haven't studied your code in detail (I won't be qualified to judge it) but I notice this comment: /* Hit the faster unicode_concatenate method if and only if all the following conditions are true: 1. The left operand is a unicode type 2

[issue27459] unintended changes occur when dealing with list of list

2016-07-05 Thread Steven D'Aprano
Steven D'Aprano added the comment: Hi Zhihan Chen, I see this issue is closed, but for future reference please don't post screenshots to report issues unless they are really needed. For text output, just copy the text from your terminal and paste it into your bug report. Making a screen shot

[issue27463] Floor division is not the same as the floor of division

2016-07-07 Thread Steven D'Aprano
Steven D'Aprano added the comment: The behaviour of both are correct: the binary float nearest to 4.4 is just a smidgen *bigger* than the exact decimal 4.4, so 44//4.4 truncates to 9.0. But floor(44/4.4) evaluates 44/4.4 first, and that rounds rather than truncating, giving 10.0, which

[issue27181] Add geometric mean to `statistics` module

2016-07-08 Thread Steven D'Aprano
Steven D'Aprano added the comment: Does anyone have any strong feeling about the name for these functions? gmean and hmean; geometric_mean and harmonic_mean And "subcontrary_mean" is not an option :-) -- ___ Python tracker <rep...@bu

[issue27181] Add geometric mean to `statistics` module

2016-08-09 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Tue, Aug 09, 2016 at 06:44:22AM +, Ram Rachum wrote: > For `geometric_mean`, maybe I'd add one sentence that describes > how the geometric mean is calculated. What do you mean? As in, the mathematical definition of geometric mean? Or do you mean

[issue6422] timeit called from within Python should allow autoranging

2016-08-07 Thread Steven D'Aprano
Steven D'Aprano added the comment: Nick gave a +1 to my auto-range patch with callback on 2016-05-13, and there's been no negative feedback since. Should I go ahead and check it in for 3.6? -- ___ Python tracker <rep...@bugs.python.org>

[issue27708] Roudning/Large Int representation error with multiplication and division

2016-08-08 Thread Steven D'Aprano
Steven D'Aprano added the comment: Your description is hard to understand, and doesn't give enough detail, but I *think* I can guess what you might be referring to. If you start with a really big integer, and divide, you get a float. But really big floats cannot represent every number exactly

[issue27708] Roudning/Large Int representation error with multiplication and division

2016-08-08 Thread Steven D'Aprano
Steven D'Aprano added the comment: > Converting n to an int Oops. Obviously I meant converting n *from* an int *to* a float. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.or

[issue27439] product function patch

2016-07-02 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Sat, Jul 02, 2016 at 11:40:48AM +, Utkan Gezer wrote: > > New submission from Utkan Gezer: > > An issue of enhancement by the introduction of a built-in product() > function for the multiplication operation, functions similar to

[issue27440] Trigonometric bug

2016-07-02 Thread Steven D'Aprano
Steven D'Aprano added the comment: I know this issue is closed, but for future reference, ShubhamSingh.er, if you submit any further bug reports, please don't submit screen shots unless necessary. Just copy and paste the text from your terminal into the issue tracker. A screen shot is more

[issue27353] Add nroot function to math

2016-06-19 Thread Steven D'Aprano
New submission from Steven D'Aprano: For Issue27181 (add geometric mean to statistics module), I need a function to calculate nth roots that is more accurate than pow(x, 1/n). E.g. math.pow(1000, 1/3) returns 9.998 instead of 10.0. I have a pure-Python implementation of nroot

[issue29506] Incorrect documentation for the copy module

2017-02-08 Thread Steven D'Aprano
Steven D'Aprano added the comment: What about "administrative data structures" that should be copied? I think that "administrative data structures" is a red herring: there could be data that needs copying, and data that needs sharing and shouldn't be copied, independ

[issue12741] Add function similar to shutil.move that does not overwrite

2017-02-08 Thread Steven D'Aprano
Changes by Steven D'Aprano <steve+pyt...@pearwood.info>: -- nosy: +steven.daprano ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue12741] Add function similar to shutil.move that does not overwrite

2017-02-08 Thread Steven D'Aprano
Changes by Steven D'Aprano <steve+pyt...@pearwood.info>: -- versions: +Python 3.7 -Python 3.3 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue29433] any, all and sum should accept variadic args

2017-02-03 Thread Steven D'Aprano
Steven D'Aprano added the comment: Serhiy, that doesn't generalise to code like: any(a, b, c, *extras) which is hard to write out by hand. You would have to say bool(a or b or c or any(extras)) I think this might be worth considering on Python-Ideas. It will probably be rejected

[issue29433] any, all and sum should accept variadic args

2017-02-03 Thread Steven D'Aprano
Steven D'Aprano added the comment: > Do you think I should send a mail to the ideas list? Personally, I don't think so. You want to write any(a, b, c, d), but you can get the same effect now by writing any([a, b, c, d]). There is unlikely to be any significant performance differe

[issue29388] regex mismatch in the simple cases

2017-01-29 Thread Steven D'Aprano
Steven D'Aprano added the comment: re.match only matches at the start of the string. If you use re.search instead, you will get the results you are expecting. -- nosy: +steven.daprano resolution: -> not a bug stage: -> resolved status: open -&g

[issue18842] Add float.is_finite is_nan is_infinite to match Decimal methods

2017-01-29 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Sun, Jan 29, 2017 at 08:23:05AM +, Martin Panter wrote: > Why do you name the methods is_finite() etc with underscores, when the > existing methods math.isfinite() etc do not have underscores? Seems it > would add unnecessary confusion.

[issue29602] complex() on object with __complex__ function loses sign of zero imaginary part

2017-02-19 Thread Steven D'Aprano
Changes by Steven D'Aprano <steve+pyt...@pearwood.info>: -- nosy: +steven.daprano ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue29511] Add 'find' as build-in method for lists

2017-02-09 Thread Steven D'Aprano
Steven D'Aprano added the comment: Only 3.7 can receive new functionality. Here is a pure Python implementation of a subsequence test: https://code.activestate.com/recipes/577850-search-sequences-for-sub-sequence/ It appears to be reasonably popular on Activestate: it has about 7000 views

[issue29511] Add 'find' as build-in method for lists

2017-02-10 Thread Steven D'Aprano
Steven D'Aprano added the comment: Terry, I'm not sure if you've read this enhancement request correctly or not, because your reply when closing covers over a lot of detail which is not relevant to this feature request. > Extending this idea to 'subsequence in sequence' or > sequence

[issue29532] functools.partial is not compatible between 2.7 and 3.5

2017-02-11 Thread Steven D'Aprano
Steven D'Aprano added the comment: Confirmed that in Python 2.7 calling g() before and after modifying the dict prints 3 both times; calling g() before modifying the dict prints 3, then after modifying it prints 5. Python 3.3 behaves like 2.7, so this sounds like a regression in 3.5 or maybe

[issue29518] 'for' loop not automatically breaking (index error on line of loop header)

2017-02-10 Thread Steven D'Aprano
Steven D'Aprano added the comment: I agree with Josh: the exception you are giving doesn't seem possible with the code snippet shown. Please COPY AND PASTE (not a screen shot) the text of the entire traceback, starting with the line "Traceback..." I suspect that you may hav

[issue29290] argparse breaks long lines on NO-BREAK SPACE

2017-01-16 Thread Steven D'Aprano
New submission from Steven D'Aprano: argparse help incorrectly breaks long lines on U+u00A0 NO-BREAK SPACE. The attached script has been run on Python 3.5.3rc1 in a terminal window 80 columns wide, and it produces output:: usage: argparse_nobreak.py [-h] [--no-condensed] optional

[issue29290] argparse breaks long lines on NO-BREAK SPACE

2017-01-16 Thread Steven D'Aprano
Changes by Steven D'Aprano <steve+pyt...@pearwood.info>: Removed file: http://bugs.python.org/file46310/argparse_nobreak.py ___ Python tracker <rep...@bugs.python.org> <http://bugs.python

[issue29290] argparse breaks long lines on NO-BREAK SPACE

2017-01-16 Thread Steven D'Aprano
Steven D'Aprano added the comment: Here's a slightly simpler demo, without the (fortunately harmless) typo. -- Added file: http://bugs.python.org/file46311/argparse_nobreak.py ___ Python tracker <rep...@bugs.python.org> <http://bugs.p

[issue27813] When I assign for a item which list of single item

2016-08-20 Thread Steven D'Aprano
Steven D'Aprano added the comment: For future reference, don't post screen shots. Copy and paste the text of your code and its output. You don't program with Photoshop, you program with a text editor. Screen shots make it impossible to copy the code, search for the text, and make

[issue25564] Document that IDLE -python difference for `del __builtins__`

2016-08-24 Thread Steven D'Aprano
Steven D'Aprano added the comment: Terry J. Reedy added the comment: > Steven: "You should use `__builtin__` in Python 2 and `builtins` in > Python 3." I presume this is for import statements. My understanding is that __builtins__ is intended to be for the private us

[issue27858] Add identity function to functools

2016-08-25 Thread Steven D'Aprano
Steven D'Aprano added the comment: I had a work mate make this exact same point literally yesterday. He asked me if Python had an identity function, and when I suggested just using `lambda x: x` he grouched that this wasn't sufficiently obvious enough as "identity" is self-e

[issue27858] Add identity function to functools

2016-08-25 Thread Steven D'Aprano
Steven D'Aprano added the comment: Just in case anyone else thinks this is a good idea, here's a patch. -- keywords: +patch Added file: https://bugs.python.org/file44218/identity.patch ___ Python tracker <rep...@bugs.python.org>

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