[issue36259] exception text is being sourced from the wrong file

2019-03-10 Thread Steven D'Aprano
Change by Steven D'Aprano : -- nosy: +steven.daprano ___ Python tracker <https://bugs.python.org/issue36259> ___ ___ Python-bugs-list mailing list Unsubscr

[issue28956] return list of modes for a multimodal distribution instead of raising a StatisticsError

2019-03-11 Thread Steven D'Aprano
Steven D'Aprano added the comment: I'm closing this issue in favour of Raymond's #35892, thank you to everyone even if your PRs didn't get used, I appreciate your efforts. -- resolution: -> rejected stage: patch review -> resol

[issue36018] Add a Normal Distribution class to the statistics module

2019-03-11 Thread Steven D'Aprano
Steven D'Aprano added the comment: I've done some spot checks of NormDist.pdf and .cdf and compared the results to those returned by my TI Nspire calculator. So far, the PDF has matched that of the Nspire to 12 decimal places (the limit the calculator will show), but the CDF dif

[issue35892] Fix awkwardness of statistics.mode() for multimodal datasets

2019-03-11 Thread Steven D'Aprano
Steven D'Aprano added the comment: Looks good to me, I'm happy to accept it. Thank you for your efforts Raymond, can I trouble you to do the merge yourself please, I'm still having issues using the Github website. -- ___ Python

[issue36018] Add a Normal Distribution class to the statistics module

2019-03-11 Thread Steven D'Aprano
Steven D'Aprano added the comment: > I'm assuming you meant 5.374 rather than 5.372 in the first Nspire result. Yes, that was a typo, sorry. Thanks for checking into the results. -- ___ Python tracker <https://bugs.pytho

[issue36283] eval is needlessly limited

2019-03-13 Thread Steven D'Aprano
Steven D'Aprano added the comment: > The footnote about why eval/exec cannot be used for arbitrary code Which footnote? I see nothing here: https://docs.python.org/3/library/functions.html#eval > On that point, I still don't understand why PyObject_GetIte

[issue36314] Pivot_Table Docstring Error

2019-03-16 Thread Steven D'Aprano
Steven D'Aprano added the comment: Prakhar, for future reference, please don't submit unnecessary screenshots to report bugs. Screen shots are hostile to the blind or visually impaired, who may be reading this with a screen-reader, and they make it impossible for us to copy your c

[issue36324] Inverse cumulative normal distribution function

2019-03-18 Thread Steven D'Aprano
Steven D'Aprano added the comment: Looks good to me. Later I will do some spot checks against the results returned by the Nspire calculator, but in the meantime I think this can go in. Thanks for your efforts Raymond, I think this NormalDist is shaping up to be a great add

[issue36324] Inverse cumulative normal distribution function

2019-03-20 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Tue, Mar 19, 2019 at 01:06:45AM +0000, Steven D'Aprano wrote: > Later I will do some spot checks against the results returned by the Nspire > calculator Looks good to me, they agree to 6 decimal places in my tests. Following Mark's

[issue6422] timeit called from within Python should allow autoranging

2019-03-27 Thread Steven D'Aprano
Steven D'Aprano added the comment: > Were you working on the additional functionality that you mentioned in > msg272704 or would that be open for someone else to do? Thanks! Please consider it open. I don't expect it to be difficult, it's just finding the Round Tuits.

[issue27181] Add geometric mean to `statistics` module

2019-03-28 Thread Steven D'Aprano
Steven D'Aprano added the comment: > In the spirit of "perfect is the enemy of good", would it be > reasonable to start with a simple, fast implementation using > exp-mean-log? Then if someone wants to make it more accurate later, > they can do so. I think th

[issue35224] PEP 572: Assignment Expressions

2019-03-29 Thread Steven D'Aprano
Steven D'Aprano added the comment: You are one person, who has used this feature for what, a month elapsed time? 300 person-hours actual experience with it? Allowing top-level unparenthisized walrus expressions will affect hundreds of thousands of people, for collectively millions of

[issue36507] frozenset type breaks ZFC

2019-04-02 Thread Steven D'Aprano
Steven D'Aprano added the comment: Python is a programming language, and we're probably not going to care too much about compliance with ZFC set theory unless there is good *practical* and not theoretical reason to care. That's not to say that we want to break ZFC, only that

[issue36507] frozenset type breaks ZFC

2019-04-02 Thread Steven D'Aprano
Steven D'Aprano added the comment: (Aside: that's interesting, normally if I try to post a comment to an issue, and somebody else edits it in the meantime, the message doesn't get posted and I get a error message saying that the page has been edited. This

[issue36493] Add math.midpoint(a,b) function

2019-04-02 Thread Steven D'Aprano
Steven D'Aprano added the comment: I see this has been rejected for the math module, but I wonder whether it should be considered for Decimal? I recall Mark Dickinson demonstrating this lovely little bit of behaviour: py> from decimal import getcontext, Decimal py> getcontext().

[issue36549] str.capitalize should titlecase the first character not uppercase

2019-04-07 Thread Steven D'Aprano
New submission from Steven D'Aprano : str.capitalize appears to uppercase the first character of the string, which is okay for ASCII but not for non-English letters. For example, the letter NJ in Croatian appears as Nj at the start of words when the first character is capitalized: Nje

[issue36546] Add quantiles() to the statistics module

2019-04-07 Thread Steven D'Aprano
Steven D'Aprano added the comment: I think adding quantiles (sometimes called fractiles) is a good feature to add. I especially have some use-cases for quartiles. I especially like that it delegates to the inv_cdf() method when available, and I'm happy with the API you suggested

[issue36574] Error with self in python

2019-04-09 Thread Steven D'Aprano
Steven D'Aprano added the comment: The file you have attached doesn't seem to be a Python script, it seems to be some sort of Windows batch file or similar. Please supply an actual Python file. (Hint: remove the "del code.py" line from your batch file.) Also, copy and

[issue36574] Error with self in python

2019-04-09 Thread Steven D'Aprano
Steven D'Aprano added the comment: The error message is correct. The bug is in your code. Also, the code you tell us that you are running is not the same as the code you are actually running. You should not call __init__ directly as you do: # this is wrong Person.__init__(

[issue36617] The rich comparison operators are second class citizens

2019-04-12 Thread Steven D'Aprano
Steven D'Aprano added the comment: Sorry, I don't understand your demonstration. What's the mystery ``parser`` object with an ``expr`` method? What is it doing? Your comment says "all binary/unary number ops work" but I don't know what you mean by "work&q

[issue36646] os.listdir() got permission error in Python3.6 but it's fine in Python2.7

2019-04-16 Thread Steven D'Aprano
Steven D'Aprano added the comment: Please don't post screen shots of text, copy and paste the text as text. Screen shots are hostile to the blind and visually impaired as screen-readers don't work with them. They make it impossible for us to copy your code to run it ourselv

[issue36646] os.listdir() got permission error in Python3.6 but it's fine in Python2.7

2019-04-16 Thread Steven D'Aprano
Steven D'Aprano added the comment: Thanks Ryan. > PermissionError: [WinError 5] 拒绝访问。: 'L:\\Temp' Can you translate the error message into English for us please? -- ___ Python tracker <https://bugs.

[issue36653] Dictionary Key is without ' ' quotes

2019-04-17 Thread Steven D'Aprano
Steven D'Aprano added the comment: Hi PushkarVaity, and welcome! I hope that Matthew's suggestion fixes your code for you, but please remember that this is a bug tracker for bugs in the Python language and standard library, not a help desk. As a beginner, 99.9% of the times you

[issue36657] AttributeError

2019-04-18 Thread Steven D'Aprano
Steven D'Aprano added the comment: Hi Maakvol, Please remember that this is a bug tracker for bugs in the Python language and standard library, not a help desk. As a beginner, 99.9% of the times you think that you have found a bug in Python, you haven't, it will be a bug in you

[issue36675] Doctest directives and comments not visible or missing from code samples

2019-04-20 Thread Steven D'Aprano
New submission from Steven D'Aprano : (Apologies if this is the wrong place for reporting website bugs.) The website is not rendering doctest directives or comments, either that or the comments have been stripped from the examples. On the doctest page itself, all the comments are mi

[issue36546] Add quantiles() to the statistics module

2019-04-26 Thread Steven D'Aprano
Steven D'Aprano added the comment: Hi Raymond, Thanks for working on this, I'm really keen to see this happen and I appreciate your efforts so far. Your arguments have also convinced me that the default calculation type you chose (PERCENTILE.EXC or R type=6) is suitable. Bu

[issue36754] Remove smart quotes in pydoc text

2019-04-29 Thread Steven D'Aprano
Steven D'Aprano added the comment: > Not all console configurations can correctly render smart quotes in > help() text. See the "Æ" in "superclass's" below. That suggests to me a mismatch in encodings, rather than inability to render curly quotes at all. I

[issue36774] f-strings: Add a !d conversion for ease of debugging

2019-05-02 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Thu, May 02, 2019 at 11:40:45AM +, Eric V. Smith wrote: > > New submission from Eric V. Smith : > > I originally propsed this here: > https://mail.python.org/pipermail/python-ideas/2018-October/053956.html, and > there has al

[issue36788] Add clamp() function to builtins

2019-05-03 Thread Steven D'Aprano
Steven D'Aprano added the comment: I doubt this is important enough to go into builtins, the only practical use-case I know of for this function is with numbers, so this could go in the math module. But putting that aside, there are some other problems: - it isn't clear that

[issue36774] f-strings: Add a !d conversion for ease of debugging

2019-05-03 Thread Steven D'Aprano
Steven D'Aprano added the comment: > Steven: We shouldn't block this immediately useful feature from going > in for f-strings on waiting for some much broader first class access > to expressions feature. !d would be practical today. I hear you, and after giving it much m

[issue36872] passing negative values through modules

2019-05-10 Thread Steven D'Aprano
Steven D'Aprano added the comment: David, I'm pretty sure that SilentGhost is correct. You are misreading the error message: it has nothing to do with the negative index. The problem is that your `insert_value` function returns None, not the list. I believe that what you have done

[issue36892] "Modules" section in Tutorial contains incorrect description about __init__.py

2019-05-11 Thread Steven D'Aprano
Steven D'Aprano added the comment: In my experience, beginners have enough trouble getting packages right without complicating the tutorial with a rarely-used advanced feature like namespace packages. I don't think this needs more than perhaps a footnote, if that. -

[issue36887] Add integer square root, math.isqrt

2019-05-11 Thread Steven D'Aprano
Steven D'Aprano added the comment: Yes please for this! The two usual versions are isqrt and nsqrt: isqrt(n) = largest integer ≤ √n nsqrt(n) = closest integer to √n although to be honest I'm not sure what use cases there are for nsqrt. -- nosy: +stev

[issue36906] Compile time textwrap.dedent() equivalent for str or bytes literals

2019-05-13 Thread Steven D'Aprano
Steven D'Aprano added the comment: +1 There's a long thread on something similar here: https://mail.python.org/pipermail/python-ideas/2018-March/049564.html Carrying over into the following month: https://mail.python.org/pipermail/python-ideas/2018-April/049582.html Here'

[issue36906] Compile time textwrap.dedent() equivalent for str or bytes literals

2019-05-15 Thread Steven D'Aprano
Steven D'Aprano added the comment: For the record, I just came across this proposed feature for Java: https://openjdk.java.net/jeps/8222530 Add text blocks to the Java language. A text block is a multi-line string literal that avoids the need for most escape sequ

[issue36675] Doctest directives and comments missing from code samples

2019-05-16 Thread Steven D'Aprano
Steven D'Aprano added the comment: > Doctest directives in code examples should be suppressed everywhere > *except* in the doctest.html examples showing how to use directives. > The patch only exposes them for doctest.html and not for ctypes or > anywhere else. Thanks f

[issue32543] odd floor division behavior

2018-01-12 Thread Steven D'Aprano
Steven D'Aprano added the comment: That does look at first glance like a bug in // to me. 0.9/0.1 is correctly rounded to 9.0 exactly, so flooring it should return 9 (as it does): # Python 3.5 on Linux py> 0.9/0.1 == 9 True py> math.floor(0.9/0.1) 9 So I too would expect that 0.9/

[issue32589] Statistics as a result from timeit

2018-01-17 Thread Steven D'Aprano
Steven D'Aprano added the comment: What sort of statistics, and why do you think they are going to be meaningful? Measurement errors in the timings aren't two-sided, they are only one-sided, which means calculating the mean and standard deviation isn't appropriate. This is do

[issue32589] Statistics as a result from timeit

2018-01-17 Thread Steven D'Aprano
Steven D'Aprano added the comment: > What sort of statistics...? I answered my own question... I see that in your PR, you return a dict with the mean, median, *population* variance and standard deviation, and total. Why the population variance/stdev rather than the sample? Th

[issue32590] Proposal: add an "ensure(arg)" builtin for parameter validation

2018-01-17 Thread Steven D'Aprano
Steven D'Aprano added the comment: Oh I can just imagine the bike-shedding on this one :-) I'm not really convinced this is needed, but for what it's worth I think that given the intended use-case (checking function parameters) ValueError would be a more appropriate default

[issue32590] Proposal: add an "ensure(arg)" builtin for parameter validation

2018-01-18 Thread Steven D'Aprano
Steven D'Aprano added the comment: Since this is intended for argument checking, i.e. testing preconditions, the Eiffel term "require" seems more appropriate. https://www.eiffel.org/doc/eiffel/ET:%20Design%20by%20Contract%20(tm),%20Assertions%20and%20Exception

[issue32603] Deprecation warning on strings used in re module

2018-01-19 Thread Steven D'Aprano
Steven D'Aprano added the comment: I agree with Cheryl that it would be a good idea to mention this change in the re docs, since regexes are especially likely to run into this issue. -- nosy: +steven.daprano ___ Python tracker &

[issue32589] Statistics as a result from timeit

2018-01-20 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Fri, Jan 19, 2018 at 11:48:46PM +, STINNER Victor wrote: > The timeit module of the stdlib computes 5 values by default... I'm > not sure that it's revelant to compute the standard deviation only on > 5 values. I made the sam

[issue32607] After Python Installation Error

2018-01-21 Thread Steven D'Aprano
Steven D'Aprano added the comment: This looks like a broken or incorrectly configured Django installation. What happens when you run this from your operating system shell? python3.6 -E -S If you are on Windows, you might need to use this instead: py -E -S -- nosy: +steven.da

[issue32619] multiplication error

2018-01-22 Thread Steven D'Aprano
Steven D'Aprano added the comment: This is not a bug, it is a FAQ to do with the properties of binary floating point numbers. https://docs.python.org/3/faq/design.html#why-are-floating-point-calculations-so-inaccurate -- nosy: +steven.daprano resolution: -> not a b

[issue32657] Mutable Objects in SMTP send_message Signature

2018-01-24 Thread Steven D'Aprano
Steven D'Aprano added the comment: Hi Kenny, and thanks, but I'm not sure what your point is. Are you claiming this is a bug in the code or the documentation? For what it is worth... mutable defaults *are* a "gotcha", so the documentation isn't wrong. And mutable d

[issue32657] Mutable Objects in SMTP send_message Signature

2018-01-25 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Thu, Jan 25, 2018 at 02:28:17PM +, R. David Murray wrote: > obviously I missed that mutation of the value > in the code review of the patch that added those lines :( The docstring for send_message does say If the sender or any of th

[issue32683] isinstance is calling ob.__getattribute__ as a fallback instead of object.__class__.__get__

2018-01-26 Thread Steven D'Aprano
Steven D'Aprano added the comment: Dan, I don't understand what you think the code snippet shows: you're calling isclass on an object which *actually is a class* and show that it returns True. What did you expect it to return? How does the code snippet you give demonstrate

[issue32778] Hi

2018-02-05 Thread Steven D'Aprano
Change by Steven D'Aprano : -- stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue32778> ___ ___ Python-bugs-

[issue32783] ln(2) isn't accurate in _math.c in cpython

2018-02-06 Thread Steven D'Aprano
Steven D'Aprano added the comment: Thanks for the link to the Stackoverflow discussion. Currently there are three answers: two (correctly) answer that the constant as given is the most accurate value for IEEE-754 floats. Tim Peters has answered that: https://stackoverflow.com/a/486

[issue32856] Optimize the `for y in [x]` idiom in comprehensions

2018-02-16 Thread Steven D'Aprano
Steven D'Aprano added the comment: +1 Please also support using a one-element tuple: `for y in (f(x),)` -- nosy: +steven.daprano ___ Python tracker <https://bugs.python.org/is

[issue28956] return minimum of modes for a multimodal distribution instead of raising a StatisticsError

2018-02-18 Thread Steven D'Aprano
Steven D'Aprano added the comment: What makes the minimum mode better than the maximum? -- ___ Python tracker <https://bugs.python.org/issue28956> ___ ___

[issue32876] HTMLParser raises exception on some inputs

2018-02-19 Thread Steven D'Aprano
Steven D'Aprano added the comment: The stdlib HTML parser requires correct HTML. To parse broken HTML, as you find in the real world, you need a third-party library like BeautifulSoup. BeautifulSoup is much more complex (about 7-8 times as many LOC) but can handle nearly anything a br

[issue32906] AttributeError: 'NoneType' object has no attribute 'sendall'

2018-02-21 Thread Steven D'Aprano
Steven D'Aprano added the comment: Hi, this is for tracking bugs in the Python interpreter and standard library, not asking for help debugging your own code. There's no reason (yet) to believe this error is a bug in Python, you need to debug it first to ensure it is not a bug i

[issue32917] ConfigParser writes a superfluous final blank line

2018-02-22 Thread Steven D'Aprano
Steven D'Aprano added the comment: Its not a superfluous blank line. It is standard convention for Unix tools to end text files (of which ini files are a kind of text file) with a final newline \n. There are various reasons for this, but it doesn't matter what those reason

[issue32917] ConfigParser writes a superfluous final blank line

2018-02-22 Thread Steven D'Aprano
Steven D'Aprano added the comment: Oh, I forgot... even if it is decided that this trim_final_blankline parameter was desirable, the patch isn't sufficient to be accepted. You would need to also supply documentation and tests. --

[issue32929] Change dataclasses hashing to use unsafe_hash boolean (default to False)

2018-02-23 Thread Steven D'Aprano
Steven D'Aprano added the comment: This is a truly awful name, there's nothing unsafe about the hash parameter. We rightly hesitate to label *actual* unsafe functions, like eval and exec, with that name. Are we committed to this name? -- nosy: +stev

[issue32945] sorted(generator) is slower than sorted(list-comprehension)

2018-02-25 Thread Steven D'Aprano
Steven D'Aprano added the comment: I think the difficulty here is that your perspective is backwards. It isn't that sorting a generator is *slower*, it is that sorting a list is *faster*, because there is more information available with a list and so the interpreter can take a

[issue32917] ConfigParser writes a superfluous final blank line

2018-03-10 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Sat, Mar 10, 2018 at 06:37:28AM +, TitanSnow wrote: > > TitanSnow added the comment: > > If we treat the original behavior as a bug, > it’s much easier to write a patch > that just changes the default behavior > and never

[issue33084] Computing median, median_high an median_low in statistics library

2018-03-16 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Fri, Mar 16, 2018 at 02:32:36PM +, Mark Dickinson wrote: > For what it's worth, NumPy gives a result of NaN for the median of an array > that contains NaNs: By default, R gives the median of a list containing either NaN or NA

[issue33089] Add multi-dimensional Euclidean distance function to the math module

2018-03-16 Thread Steven D'Aprano
Steven D'Aprano added the comment: This was requested once before, but rejected. I would like to see that decision re-considered. https://bugs.python.org/issue1880 Some months ago, there was a very brief discussion started by Lawrence D’Oliveiro about this on the comp.lang.python news

[issue33089] Add multi-dimensional Euclidean distance function to the math module

2018-03-16 Thread Steven D'Aprano
Steven D'Aprano added the comment: The obvious work-around of calling hypot multiple times is not only tedious, but it loses precision. For example, the body diagonal through a 1x1x1 cube should be √3 exactly: py> from math import hypot, sqrt py> hypot(hypot(1, 1), 1) == sqrt(3

[issue33089] Add multi-dimensional Euclidean distance function to the math module

2018-03-16 Thread Steven D'Aprano
Steven D'Aprano added the comment: Ah wait, I appear to have misunderstood Raymond's request. Sorry Raymond! (I've been spending too much time teaching Pythagoras' theorem and my mind was primed to go directly from Euclidean distance to hypotenuse.) Not withstanding my

[issue33108] Unicode char 304 in lowercase has len = 2

2018-03-20 Thread Steven D'Aprano
Steven D'Aprano added the comment: It has never been the case that upper() or lower() are guaranteed to preserve string length in Unicode. For example, some characters decompose into a base plus combining characters. Ligatures are another example. See here for more details:

[issue33157] Strings beginning with underscore not removed from lists - feature or bug?

2018-03-27 Thread Steven D'Aprano
Steven D'Aprano added the comment: In addition to Xiang Zhang's comments, this is neither a feature nor a bug, but a misunderstanding. This has nothing to do with strings or underscores: py> L = [1, 2, 3, 4, 5] py> for item in L: ... L.remove(item) ... py> L [2, 4]

[issue33186] Memory corruption with urllib.parse

2018-03-30 Thread Steven D'Aprano
Steven D'Aprano added the comment: Alexey, I'm afraid I can't make heads or tails of your bug report. You've gone into a detailed description of the "bad results" you have, but you haven't explained *why* they're bad, or what you were expecting. I&

[issue32337] Dict order is now guaranteed, so add tests and doc for it

2018-04-03 Thread Steven D'Aprano
Steven D'Aprano added the comment: I started to add this comment to #33218 but Raymond closed that ticket while I was editing it. In 3.6, dicts preserving insertion order remains an implementation detail that cannot be relied on. It only becomes a guarantee in 3.7. Even in 3.7, I think

[issue33233] Suggest third-party cmd2 module as alternative to cmd

2018-04-06 Thread Steven D'Aprano
Steven D'Aprano added the comment: (Previously posted on Python-Dev.) I think the documentation note is a good idea. But I disagree with deprecating "cmd" unless it is actively falling apart and no longer working, not just languishing with no feature improvements. Just in the

[issue33292] Fix secrets.randbelow docstring

2018-04-17 Thread Steven D'Aprano
Steven D'Aprano added the comment: Possibly you may not be familiar with interval notation? https://www.mathsisfun.com/sets/intervals.html Since this is Python and not maths, maybe we should rethink the wording. -- ___ Python tracker &

[issue33304] Syntax Error on leading 0 in integer tokens

2018-04-17 Thread Steven D'Aprano
Steven D'Aprano added the comment: This is not a bug, it is intentional. In Python 2, numbers with a leading zero are interpreted as octal, leading to surprising results: py> 015 13 In Python 3, we use 0o15 to get octal, and 015 becomes a syntax error. -- nosy: +steven

[issue33305] Improve syntax error for numbers with leading zero

2018-04-17 Thread Steven D'Aprano
New submission from Steven D'Aprano : The Python 2.x syntax for octal integers is a syntax error in 3.x, but the error message is very uninformative: SyntaxError: invalid token Can this be improved? Perhaps to something like: invalid token, use 0o prefix for octal integers (see

[issue33305] Improve syntax error for numbers with leading zero

2018-04-17 Thread Steven D'Aprano
Change by Steven D'Aprano : -- type: behavior -> enhancement ___ Python tracker <https://bugs.python.org/issue33305> ___ ___ Python-bugs-list mailing li

[issue33304] Syntax Error on leading 0 in integer tokens

2018-04-17 Thread Steven D'Aprano
Steven D'Aprano added the comment: I've opened an issue to improve the error message: #33305 -- ___ Python tracker <https://bugs.python.org/issue33304> ___ __

[issue33322] Overridden __getitem__ not called on use of slice syntax when inheriting from tuple

2018-04-21 Thread Steven D'Aprano
Steven D'Aprano added the comment: In Python 2, you have to override __getslice__ as well as __getitem__. Try this instead: class MyTuple(tuple): def __getitem__(self, pos): print "get item {}".format(pos) return super(MyTuple, self).__getitem__(pos) d

[issue33362] string strip() strips extra characters that it shouldn't

2018-04-25 Thread Steven D'Aprano
Steven D'Aprano added the comment: the argument to string.strip (also lstrip and rstrip) is not an exact substring to remove, but a set of characters to remove: py> 'zyxzz1234'.strip('xyz') '1234' -- nosy: +steven.daprano resolution: -> n

[issue33372] Wrong calculation

2018-04-26 Thread Steven D'Aprano
Steven D'Aprano added the comment: I agree with Tim that this is likely to be the difference between Python 2 truncating division and Python 3 division. For the record, I get the following results: 9997809507L Python 2.7 9997809307.0 Python 3.5 9997809307 R 9997809307 Javascript (

[issue33372] Wrong calculation

2018-04-26 Thread Steven D'Aprano
Steven D'Aprano added the comment: > Even Ruby gets the right answer (9997809507) for that :-) Oops, I forgot to say... Ruby 1.8 also does truncating division like Python 2. -- ___ Python tracker <https://bugs.python.org

[issue33372] Wrong calculation

2018-04-26 Thread Steven D'Aprano
Steven D'Aprano added the comment: Ah sheesh I copied and pasted the wrong bits. After the division terms go to zero, you get -590072-200112-18-18-18-18-18-18-18-18+9998599835 which goes to 9997809507 as calculated by Ruby and Python 2, and I promise that's the end of me replying

[issue33390] matmul @ operator precedence

2018-04-29 Thread Steven D'Aprano
Steven D'Aprano added the comment: Precedence issues when dealing with units is unavoidable, I think. The units program on Linux/Unix has similar issues, and they write their own parser and choose their own precedence. https://www.gnu.org/software/units/manual/html_node/Operators.htm

[issue33402] Change the fractions.Fraction class to convert to a unicode fraction string

2018-05-01 Thread Steven D'Aprano
Steven D'Aprano added the comment: Strings in Python 3 are already unicode. Looking at the patch, I see a lot of fractions which display as the missing glyph white square. For example, instead of seeing 1/9, which displays perfectly everywhere, I see a mysterious box similar to □. Even

[issue33404] Phone Number Generator

2018-05-01 Thread Steven D'Aprano
Steven D'Aprano added the comment: Hi Braiden, and welcome! I see that the ticket has already been closed, but another note for the future: please don't paste screenshots of your code, copy and paste the relevant source code. We don't edit code with Photoshop, and posting

[issue33411] All console message are in the error output in bash interpretor

2018-05-02 Thread Steven D'Aprano
Steven D'Aprano added the comment: Hello Quentin, and welcome. Please don't post screen shots of text. We don't edit our code with Photoshop, and using a screenshot makes it difficult to copy your code for testing, to verify the bug report, and prevents the blind and visuall

[issue33424] 4.4. break and continue Statements, and else Clauses on Loops

2018-05-03 Thread Steven D'Aprano
Steven D'Aprano added the comment: Joe, we have no idea what you think is the bug. It is intentional that the second argument for range is excluded. This is called an "half-open" range, and it helps avoid off-by-one and signpost errors. Your comments about break, continue and

[issue33430] Import secrets module in secrets examples

2018-05-05 Thread Steven D'Aprano
Steven D'Aprano added the comment: I've always expected that documentation for a module can assume that the module itself, and/or the function being described, has been imported. On the other hand, I have no objection to making this explicit, especially in the recipes section wher

[issue21592] Make statistics.median run in linear time

2018-05-06 Thread Steven D'Aprano
Steven D'Aprano added the comment: How does the performance change with this patch? Quick-select is a nice idea in theory, but unless it is written in C, it is unlikely to beat sorting the list unless you have HUGE data sets. Its been nearly four years since I last did some benchmarks

[issue33494] random.choices ought to check that cumulative weights are in ascending order

2018-05-14 Thread Steven D'Aprano
New submission from Steven D'Aprano : As mentioned on the Python-List: https://mail.python.org/pipermail/python-list/2018-May/733061.html random.choices() silently returns the wrong values when cumulative weights are not given, i.e. if the user misreads the documentation and provides

[issue33494] random.choices ought to check that cumulative weights are in ascending order

2018-05-14 Thread Steven D'Aprano
Steven D'Aprano added the comment: On Mon, May 14, 2018 at 11:54:32AM +, Paul Moore wrote: > Requiring a pre-check on cum_weights (for example, the obvious check > that the sequence is nondecreasing) would add an O(n) step, and so > significantly impact performance for t

[issue33501] split existing optimization levels into granular options

2018-05-14 Thread Steven D'Aprano
Change by Steven D'Aprano : -- nosy: +steven.daprano ___ Python tracker <https://bugs.python.org/issue33501> ___ ___ Python-bugs-list mailing list Unsubscr

[issue31757] Tutorial: Fibonacci numbers start with 1, 1

2017-10-11 Thread Steven D'Aprano
Change by Steven D'Aprano : -- nosy: +steven.daprano ___ Python tracker <https://bugs.python.org/issue31757> ___ ___ Python-bugs-list mailing list Unsubscr

[issue31797] Python 3.6.3: JSON loop fails using elif

2017-10-16 Thread Steven D'Aprano
Steven D'Aprano added the comment: What are you claiming is the bug? I don't understand what you think the problem is. Don't dump a large script in our laps and expect us to get a Google API key to run it. Forget that, it isn't going to happen. Simplify your code t

[issue31797] Python 3.6.3: JSON loop fails using elif

2017-10-16 Thread Steven D'Aprano
Steven D'Aprano added the comment: Oops, accidentally messed up the status. Fixing now. Francesco, if you simplify your code and come back with a detailed description of what you think the bug is, then we will investigate. -- nosy: +eric.smith resolution: -> not a b

[issue31895] Native hijri calendar support

2017-10-29 Thread Steven D'Aprano
Steven D'Aprano added the comment: Python 2.7 is in feature freeze, so 3.7 is the absolute earliest this could be introduced. Given how close we are to 3.7 feature freeze, 3.8 is more likely. I don't think we would have any objections to supporting hijri calendar, in principle

[issue31915] (list).insert() not working

2017-10-31 Thread Steven D'Aprano
Steven D'Aprano added the comment: Thank you for taking the time to report what you thought was a bug, but your example is way too complicated for a bug report. We shouldn't have to study your entire program to understand what the problem is. I can see at least one bug in

[issue31915] (list).insert() not working

2017-10-31 Thread Steven D'Aprano
Change by Steven D'Aprano : -- stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue31915> ___ ___ Python-bugs-

[issue31984] startswith and endswith leak implementation details

2017-11-08 Thread Steven D'Aprano
Steven D'Aprano added the comment: Thank you for the bug report Ronan, but I'm afraid that I have no idea what you think the problematic behaviour is. I'm not going to spend the time installing the third-party hypothesis module, and learning how to use it, just to decipher yo

[issue31984] startswith and endswith leak implementation details

2017-11-08 Thread Steven D'Aprano
Steven D'Aprano added the comment: I don't have Python 3.7 available to me, but in 3.5 the behaviour of u.startswith(v) with an empty v seems consistent to me: py> "alpha".startswith("", 20, 30) True py> "alpha"[20:30].startswith(""

[issue32003] multiprocessing.Array("b", 1), multiprocessing.Array("c", 1 ) wrong value returned

2017-11-10 Thread Steven D'Aprano
Steven D'Aprano added the comment: I don't understand why you think they are the wrong values. What values were you expecting? You have a byte array, you set the value to the byte b's', which is 115, and you get 115. You have a (byte) character array, you set the va

[issue32005] mutliprocessing.Array misleading error message in slice assignment

2017-11-10 Thread Steven D'Aprano
New submission from Steven D'Aprano : multiprocessing.Array slice assignment claims to require a single character even if it requires more than one: py> arr = multiprocessing.Array('c', 3) py> arr[:] = b'xyz' # works py> arr[:] = 'xyz' Traceback (m

[issue32005] multiprocessing.Array misleading error message in slice assignment

2017-11-10 Thread Steven D'Aprano
Change by Steven D'Aprano : -- title: mutliprocessing.Array misleading error message in slice assignment -> multiprocessing.Array misleading error message in slice assignment ___ Python tracker <https://bugs.python.org

[issue32006] multiprocessing.Array 'c' code is not documented

2017-11-10 Thread Steven D'Aprano
New submission from Steven D'Aprano : multiprocessing.Array is documented as taking the same character codes as array.array, but it also takes 'c' which is not documented. https://docs.python.org/3/library/multiprocessing.html#multiprocessing.Array https://docs.python.org/3/lib

<    5   6   7   8   9   10   11   12   13   14   >