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

2016-07-19 Thread Steven D'Aprano
Changes by Steven D'Aprano : Removed file: http://bugs.python.org/file43791/code.patch ___ Python tracker <http://bugs.python.org/issue27573> ___ ___ Python-bugs-l

[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 <http://bugs.python.org/is

[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

[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 whi

[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 <http://bugs.python.o

[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, n

[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 SP

[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 t

[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 &

[issue27389] When a TypeError is raised due to invalid arguments to a method, it should use __qualname__ to identify the class the method is in

2016-08-04 Thread Steven Barker
Steven Barker added the comment: Yes, this looks to be a duplicate of that issue. I'm closing this issue as a duplicate, but I don't seem to be able to set the Superseder field. If you can, please set that to Issue 2786. -- resolution: -> duplicate status: o

[issue2786] Names in function call exception should have class names, if they're methods

2016-08-04 Thread Steven Barker
Steven Barker added the comment: A few weeks ago I reported issue 27389 which looks to be a duplicate of this issue. Has any progress been made on this issue? -- nosy: +Steven.Barker ___ Python tracker <http://bugs.python.org/issue2

[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 <http://bugs.python.

[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 numb

[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 <http://bugs.python.org

[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 d

[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, cop

[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 havin

[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

[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 <http://bugs.python.org/is

[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 messag

[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

[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 <http://bugs.python.o

[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

[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-

[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 r

[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

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

2016-08-14 Thread Steven D'Aprano
Changes by Steven D'Aprano : -- resolution: -> fixed stage: -> resolved status: open -> closed ___ Python tracker <http://bugs.python.org/issue27573> ___ __

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

2016-08-18 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Thu, Aug 18, 2016 at 08:19:25AM +, Armin Rigo wrote: > Can we make the exit message optional? Sure. What API do you prefer? I'm thinking to just give interact() an optional "exitmsg" argument, similar to banner: def interact(ban

[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 tex

[issue27832] fractions.Fraction with 3 arguments: error passes silently

2016-08-23 Thread Steven D'Aprano
Steven D'Aprano added the comment: At the risk of muddying the waters even further, I'd like to make _normalize a public parameter in Python 3.7. There's an interesting operation you can do with fractions, the mediant: https://en.wikipedia.org/wiki/Mediant_%28mathe

[issue27825] Make the documentation for statistics' data argument clearer.

2016-08-23 Thread Steven D'Aprano
Changes by Steven D'Aprano : -- assignee: docs@python -> steven.daprano nosy: +steven.daprano ___ Python tracker <http://bugs.python.org/issue27825> ___ _

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

2016-08-23 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Thu, Aug 18, 2016 at 12:26:56PM +, Armin Rigo wrote: > ...ah, upon closer inspection, we don't use the ``interact()`` method > anyway. We already copied and tweaked this method: one problem was > that it gives no way to run withou

[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 privat

[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"

[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 <https://bugs.python.o

[issue27761] Private _nth_root function loses accuracy

2016-08-28 Thread Steven D'Aprano
Steven D'Aprano added the comment: This has been really eye-opening, and I just wanted to drop you a note that I am watching this thread carefully. My first priority is to get the tests all passing before beta 1 on 2016-09-12, even if (as seems likely) that means weakening the tests, and

[issue27901] inspect.ismethod returns different results on the same basic code between Python2.7 Python3.5

2016-08-30 Thread Steven D'Aprano
Steven D'Aprano added the comment: > I do think that the documentation could be a lot clearer. Which specific documentation are you referring to? The "What's New" document from 3.0? That's a historical document, a snapshot of the past. If you have a concern abo

[issue5845] rlcompleter should be enabled automatically

2013-05-06 Thread Steven D'Aprano
Steven D'Aprano added the comment: I'm not able to test the patch at the moment, but since it essentially just uses the recipe in the docs, I expect it will have the same side-effect. Namely, it prevents you using the tab key to indent in the interactive interpreter. Now I don

[issue17991] ctypes.c_char gives a misleading error when passed a one-character unicode string

2013-05-15 Thread Steven Barker
New submission from Steven Barker: While investigating a Stack Overflow question (http://stackoverflow.com/questions/16484764/multiprocessing-value-clear-syntax) I came across a misleading error message from the multiprocessing.Value constructor: >>> import multiprocessing >>

[issue17991] ctypes.c_char gives a misleading error when passed a one-character unicode string

2013-05-15 Thread Steven Barker
Changes by Steven Barker : -- components: +ctypes -Library (Lib) ___ Python tracker <http://bugs.python.org/issue17991> ___ ___ Python-bugs-list mailing list Unsub

[issue23017] string.printable.isprintable() returns False

2014-12-12 Thread Steven D'Aprano
Changes by Steven D'Aprano : -- nosy: +steven.daprano ___ Python tracker <http://bugs.python.org/issue23017> ___ ___ Python-bugs-list mailing list Unsubscr

[issue22979] Use of None in min and max

2014-12-12 Thread Steven D'Aprano
Steven D'Aprano added the comment: Even though I agree with closing this issue, there is some support for ignoring certain "missing values" when calculating min() and max(). The draft 2008 revision of IEEE-754 includes two functions maxNum and minNum which silently skip ov

[issue23045] json data iteration through loop in python

2014-12-12 Thread Steven D'Aprano
Steven D'Aprano added the comment: This is a bug tracker for issues in the Python language and standard library, not a service for learning how to program using Python. If you have an actual bug to report, you should give more detail including the actual code you used, the result you exp

[issue23201] Decimal(0)**0 is an error, 0**0 is 1, but Decimal(0) == 0

2015-01-09 Thread Steven D'Aprano
Steven D'Aprano added the comment: Mark Dickson wrote: > I've talked to Mike Cowlishaw (the author of the specification) > about this particular issue, and the spec is not likely to > change on this point. I'm curious about the rationale for the decision. As I'm s

[issue23406] interning and list comprehension leads to unexpected behavior

2015-02-07 Thread Steven D'Aprano
Steven D'Aprano added the comment: This is already a FAQ: https://docs.python.org/2/faq/programming.html#how-do-i-create-a-multidimensional-list I guess this bites every beginning Python programmer, but it's a natural, and desirable, consequence of Python's object model an

[issue23447] Relative imports with __all__ attribute

2015-02-12 Thread Steven Barker
Steven Barker added the comment: This issue is a special case of the problem discussed in issue 992389, that modules within packages are not added to the package dictionary until they are fully loaded, which breaks circular imports in the form "from package import module". The co

[issue20575] Type handling policy for the statistics module

2015-02-15 Thread Steven D'Aprano
Steven D'Aprano added the comment: Thanks for the note Mark. I need to give Oscar's comments some careful and distraction-free thought, but off the top of my head I think Oscar's suggestion to require consistent types seems reasonable, except that mixing int with any other

[issue12782] Multiple context expressions do not support parentheses for continuation across lines

2015-02-15 Thread Steven D'Aprano
Steven D'Aprano added the comment: This has come up on Python-Ideas again: http://permalink.gmane.org/gmane.comp.python.ideas/32002 https://mail.python.org/pipermail/python-ideas/2015-February/032000.html -- nosy: +steven.daprano ___ Python tr

[issue23495] The writer.writerows method should be documented as accepting any iterable (not only a list)

2015-02-20 Thread Steven Barker
New submission from Steven Barker: The documentation for the csv.writer.writerows method says that it expects "a list of row objects", when it really will accept any iterable that yields rows (such as a generator). While it's often nice for code to be more accepting than

[issue23495] The writer.writerows method should be documented as accepting any iterable (not only a list)

2015-02-20 Thread Steven Barker
Steven Barker added the comment: Another Stack Overflow user pointed out that the DictWriter's writerows implementation (in pure Python) unnecessarily converts whatever its argument is into a list in memory before passing it on to the builtin writer.writerows method which would accep

[issue24379] slice.literal notation

2015-06-04 Thread Steven D'Aprano
Steven D'Aprano added the comment: I'm with Serhiy, I don't think we need a "literal", just make slice itself indexable: reverse = slice(None, None, -1) reverse = slice[::-1] The only question in my mind is what slice should do when given just a single index: slice[

[issue24392] pop functioning

2015-06-06 Thread Steven D'Aprano
Steven D'Aprano added the comment: The behaviour is correct, this is not a bug. Each time you pop from aa, the following items move down one space. Then, the next time you pop, the items have moved: ['a0', 'b1', 'c2', 'd3', 'e4', 

[issue19915] int.bit_at(n) - Accessing a single bit in O(1)

2015-06-07 Thread Steven D'Aprano
Changes by Steven D'Aprano : -- nosy: +steven.daprano ___ Python tracker <http://bugs.python.org/issue19915> ___ ___ Python-bugs-list mailing list Unsubscr

[issue18814] Add utilities to "clean" surrogate code points from strings

2015-06-07 Thread Steven D'Aprano
Changes by Steven D'Aprano : -- nosy: +steven.daprano ___ Python tracker <http://bugs.python.org/issue18814> ___ ___ Python-bugs-list mailing list Unsubscr

[issue24438] Strange behaviour when multiplying imaginary inf by 1

2015-06-12 Thread Steven D'Aprano
Steven D'Aprano added the comment: I've found the same behaviour going back to Python 1.5. I think what happens here is that (0+∞j)*1 evaluates the multiplication by implicitly coercing the int to a complex: (0+∞j)*(1+0j) => (0*1 + ∞j*1 + 0*0j + ∞j*0j) =>

[issue24442] Readline Bindings Don't Report Any Error On Completer Function Exception

2015-06-12 Thread Steven D'Aprano
Steven D'Aprano added the comment: I disagree that it "should not be the case", I think Python's current behaviour is correct. Although it makes debugging completer functions harder, it would not be good for a bug in the completer to raise an exception and break line editi

[issue24515] docstring of isinstance

2015-06-26 Thread Steven D'Aprano
Steven D'Aprano added the comment: It already does: "The form using a tuple, isinstance(x, (A, B, ...)), is a shortcut for isinstance(x, A) or isinstance(x, B) or ... (etc.)." If it were "all", it would use "and", not "or". I don't think any

[issue24515] docstring of isinstance

2015-06-26 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Fri, Jun 26, 2015 at 09:20:18PM +, Terry J. Reedy wrote: > I agree that the tuple explanation if ok. But "Return whether an > object is an instance of a class or of a subclass thereof." (3.5) > seems wrong. I believe 'su

[issue24549] string.format() should have a safe_substitute equivalent, to be run consecutively

2015-07-01 Thread Steven D'Aprano
Steven D'Aprano added the comment: I don't think that this behaviour is desirable, certainly not by default. If I write "{1} {0}".format('one') that's clearly a programming error and I should get an exception. Chaining a second .format method call afterwar

[issue24546] sequence index bug in random.choice

2015-07-01 Thread Steven D'Aprano
Steven D'Aprano added the comment: Your example of int(0.5) returning 1 is misleading, because 0.999...95 is already 1.0. (1.0 - 1/2**53) = 0. is the nearest float distinguishable from 1.0. It seems to me that either random() may return 1.0 exactly (alt

[issue24515] docstring of isinstance

2015-07-01 Thread Steven D'Aprano
Steven D'Aprano added the comment: Closing. If anyone thinks the docs aren't clear enough, and has an alternate version they would like to suggest, you can re-open it. -- resolution: -> rejected status: open -> closed ___ Pytho

[issue24546] sequence index bug in random.choice

2015-07-02 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Thu, Jul 02, 2015 at 04:05:45AM +, Tim Peters wrote: > Very surprising! Which platform & Python is that? Python 2.7.2 (default, May 18 2012, 18:25:10) [GCC 4.1.2 20080704 (Red Hat 4.1.2-52)] on linux2 I get the same result on Python 2.6

[issue24551] byte conversion

2015-07-02 Thread Steven D'Aprano
Steven D'Aprano added the comment: I don't know, what *is* the problem? What behaviour did you expect? The code sample you show seems to be working exactly as it is supposed to. b'\x00\x00 0' is the same as b'\x00\x00\x20\x30', and that is the same as b'\x2

[issue24546] sequence index bug in random.choice

2015-07-02 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Thu, Jul 02, 2015 at 05:35:53PM +, Tim Peters wrote: > Steven, there's something wrong with the arithmetic on your machine, > but I can't guess what from here (perhaps you have a non-standard > rounding mode enabled, pe

[issue24546] sequence index bug in random.choice

2015-07-04 Thread Steven D'Aprano
Steven D'Aprano added the comment: I've been running this snippet for almost 72 hours now: s = u"БГДЖИЛЦЫЭu042eЯАВЕКМРТu042312456789" while True: state = random.getstate() try: a = random.choice(s) except IndexError: break with no results yet. I

[issue24567] random.choice IndexError due to double-rounding

2015-07-04 Thread Steven D'Aprano
New submission from Steven D'Aprano: While investigating issue 24546, I discovered that at least some versions of Python on 32-bit Linux have a double-rounding bug in multiplication which may lead to an unexpected IndexError in random.choice. See http://bugs.python.org/issue2454

[issue24546] sequence index bug in random.choice

2015-07-04 Thread Steven D'Aprano
Steven D'Aprano added the comment: I've created a new issue 24567 for the double-rounding bug. I have taken the liberty of copying the nosy list from this issue to the new one, apologies if that is inappropriate. -- assignee: -&g

[issue24551] byte conversion

2015-07-07 Thread Steven D'Aprano
Steven D'Aprano added the comment: Bytes in Python 3 do use ASCII representation: py> b'\x41' == b'A' # ASCII True If you think the documentation is unclear, please tell us which part of the docs you read (provide a URL) and we wi

[issue24551] byte conversion

2015-07-08 Thread Steven D'Aprano
Steven D'Aprano added the comment: I'm sorry, but I believe that you have misunderstood what happens here. This has nothing to do with the hex codec, or int.to_bytes() etc. This is the standard property of byte strings in Python, that they are displayed using ASCII as much as poss

[issue24601] bytes and unicode splitlines() methods differ on what is a line break

2015-07-09 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Fri, Jul 10, 2015 at 02:18:33AM +, Gregory P. Smith wrote: > for bytes, \v (0x0b) is not considered a line break. for unicode, it is. [...] > I think these should be consistent. I'm not sure that they should. Unicode includes other l

[issue24612] not operator expression raising a syntax error

2015-07-11 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Sat, Jul 11, 2015 at 03:23:53PM +, candide wrote: > > New submission from candide: > > Expressions such as > > a + not b > a * not b > + not b > - not b > > raise a SyntaxError, for instance : > > > &g

[issue24624] Itertools documentation says iterator when iterable is intended

2015-07-12 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Mon, Jul 13, 2015 at 01:37:26AM +, Neil Girdhar wrote: > > New submission from Neil Girdhar: > > In the description of the consume recipe: [...] > iterator should be replaced with iterable. This function accepts strings for >

[issue24668] Deprecate 00000 as a synonym for 0

2015-07-19 Thread Steven D'Aprano
New submission from Steven D'Aprano: As discussed on the python-ideas list here: Subject: Disallow "0" as a synonym for "0" https://mail.python.org/pipermail/python-ideas/2015-July/034631.html and on Stackoverflow, leading zeroes are forbidden for ints, due to the

[issue23447] Import fails when doing a circular import involving an `import *`

2015-07-28 Thread Steven Barker
Steven Barker added the comment: I've finally gotten around to looking into this issue and it turns out that fixing "from package import *" to work with circular imports is pretty easy, as all that needs to be done is apply the same logic from the patch for issue 17636 to the l

[issue17991] ctypes.c_char gives a misleading error when passed a one-character unicode string

2015-07-29 Thread Steven Barker
Steven Barker added the comment: I was looking over some of the bugs I've contributed to, and it looks like this one has been fixed. It should be marked as a dupe of issue 22161 and closed (I can close, but not set a superseder, it seems). -- resolution: -> duplicate stat

[issue24796] Deleting names referencing from enclosed and enclosing scopes

2015-08-05 Thread Steven D'Aprano
Steven D'Aprano added the comment: I wonder if it is a left-over from the behaviour prior to 3.2? In 3.1, I get this syntax error: py> def outer(): ... spam = 1 ... def inner(): ... nonlocal spam ... del spam ... inner() ... SyntaxError: can no

[issue24810] UX mode for IDLE targeted to 'new learners'

2015-08-06 Thread Steven D'Aprano
Steven D'Aprano added the comment: Sounds patronizing. Whether used for beginners to programming or experts, IDLE (or any other application) should start with sensible defaults. As much as possible, it should usefully start without requiring extra configuration. But beyond that, act

[issue24849] Add __len__ to map, everything in itertools

2015-08-12 Thread Steven D'Aprano
Steven D'Aprano added the comment: Unfortunately, this fails because there is no way to tell how long an arbitrary iterable is, or whether it is reentrant or not. Consider: def gen(): while True: if random.random() < 0.5: return random.random() Not only i

[issue24849] Add __len__ to map, everything in itertools

2015-08-12 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Wed, Aug 12, 2015 at 09:23:26PM +, flying sheep wrote: > Python has iterators and iterables. iterators are non-reentrant > iterables: once they are exhausted, they are useless. Correct. > But there are also iterables that create

[issue23406] interning and list comprehension leads to unexpected behavior

2015-08-31 Thread Steven D'Aprano
Steven D'Aprano added the comment: Which note are you referring to? There are at least two mentioned in this thread, the FAQ and a footnote in the docs for stdtypes. If you're referring to the table of operations just below these: https://docs.python.org/2/library/stdtypes.html#sequ

[issue23447] Import fails when doing a circular import involving an `import *`

2015-09-08 Thread Steven Barker
Steven Barker added the comment: I've managed to partially fix my build environment, so I can verify that my patch (attached previously) works as intended. I'm not completely sure that it doesn't break unrelated things as my build still has lots of failing tests (which a

[issue25177] OverflowError in statistics.mean when summing large floats

2015-09-22 Thread Steven D'Aprano
Steven D'Aprano added the comment: Bar, thanks for the time you put into diagnosing this error, it is definitely a bug. The intention is for mean([huge, huge]) to return huge, not raise OverflowError. I'm reluctant to say that mean() will *never* raise OverflowError, but it

[issue18814] Add utilities to "clean" surrogate code points from strings

2015-09-27 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Sun, Sep 27, 2015 at 04:17:45PM +, R. David Murray wrote: > > I also want "detect if there are any surrogates". I think that's useful enough it should be a str method. Here's a pure-Python implementation: def is_surr

[issue25261] Incorrect Return Values for any() and all() Built-in Functions

2015-09-28 Thread Steven D'Aprano
Steven D'Aprano added the comment: Not a bug. You have used a generator expression, so it is exhausted once you have run over it once using list(). Then, you run over it again with any() and all(), but they don't see any values so return the default value. Change the generator exp

[issue23447] Import fails when doing a circular import involving an `import *`

2015-10-01 Thread Steven Barker
Steven Barker added the comment: Thanks for looking at the issue Brett. I think you're right that your patch has incorrect semantics, since it doesn't save the value to the provided namespace if it had to go through the special path to find the name. I think my patch got that

[issue25177] OverflowError in statistics.mean when summing large floats

2015-10-10 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Sat, Oct 10, 2015 at 04:28:22PM +, Bar Harel wrote: > Any comments on the patch? Not yet, I've been unable to look at it, but thank you. If I haven't responded by the 17th of this month, pl

[issue25177] OverflowError in statistics.mean when summing large floats

2015-10-19 Thread Steven D'Aprano
Changes by Steven D'Aprano : -- assignee: -> steven.daprano ___ Python tracker <http://bugs.python.org/issue25177> ___ ___ Python-bugs-list mailing li

[issue20499] Rounding errors with statistics.variance

2015-10-19 Thread Steven D'Aprano
Changes by Steven D'Aprano : -- assignee: -> steven.daprano ___ Python tracker <http://bugs.python.org/issue20499> ___ ___ Python-bugs-list mailing li

[issue25453] Arithmetics with complex infinities is inconsistent with C/C++

2015-10-21 Thread Steven D'Aprano
Steven D'Aprano added the comment: I'm not entirely satisfied that the way it is calculated by C++11/C99 is correct. (Although I can see the appeal of the C version.) Mathematically, complex multiplication (a+bj)*x should be identical to (a+bj)*(x+0j), but obviously in the presen

[issue25564] IDLE behaves differently that the standard interpreter when someone types `del __builtins__`

2015-11-05 Thread Steven D'Aprano
Steven D'Aprano added the comment: __builtins__ is a private implementation detail in CPython. There is no guarantees made about whether it exists or not. E.g. it doesn't exist in Jython. steve@orac:~/python$ jython Jython 2.5.1+ (Release_2_5_1, Aug 4 2010, 07:18:19) [OpenJDK Serv

[issue25564] IDLE behaves differently that the standard interpreter when someone types `del __builtins__`

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

[issue25177] OverflowError in statistics.mean when summing large floats

2015-11-05 Thread Steven D'Aprano
Steven D'Aprano added the comment: Has anyone confirmed that this bug actually exists? I'm afraid that I cannot verify it. I get these results on three different computers: py> x = 8.988465674311579e+307 py> statistics.mean([x, x]) 8.988465674311579e+307 py> statistics.mea

[issue25177] OverflowError in statistics.mean when summing large floats

2015-11-05 Thread Steven D'Aprano
Steven D'Aprano added the comment: > Has anyone confirmed that this bug actually exists? Confirmed. The initial report is not quite correct: you need three values to trigger the overflow, not two: py> x = 8.988465674311579e+307 py> statistics.mean([x]*2) == x True py> stat

[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:

[issue25709] Problem with string concatenation and utf-8 cache.

2015-11-23 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Mon, Nov 23, 2015 at 09:48:46PM +, STINNER Victor wrote: > * the string has a cached UTF-8 byte string (ex: int(s) was called before the > resize) Why do strings cache their UTF-8 encoding? I presume that some of Python's internals r

[issue25177] OverflowError in statistics.mean when summing large floats

2015-12-01 Thread Steven D'Aprano
Steven D'Aprano added the comment: Larry, Is it too late to get this into 3.5rc1? changeset 99407:ed45a09e5a69 Thanks. -- nosy: +larry ___ Python tracker <http://bugs.python.org/is

[issue25928] Improve performance of statistics._decimal_to_ratio and fractions.from_decimal

2015-12-23 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Wed, Dec 23, 2015 at 03:18:28PM +, Serhiy Storchaka wrote: > May be implement the as_integer_ratio() method and/or numerator and > denominator attributes in the Decimal class? That would also be good as it will decrease the API differen

[issue25998] doctest crashes when accessing __wrapped__ fails other than AttributeError

2016-01-02 Thread Steven D'Aprano
Steven D'Aprano added the comment: doctest doesn't crash -- it is a regular exception, not a crash. "Crash" means "Hard crashes of the Python interpreter – possibly with a core dump or a Windows error box." In other words, a segmentation fault or other low-level

[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

[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

<    13   14   15   16   17   18   19   20   >