[issue46910] Expect IndentationError, get SyntaxError: 'break' outside loop

2022-03-07 Thread Jonathan Fine
Jonathan Fine added the comment: My main concern is that the door not be closed on improving the user experience relating to this behaviour of the compiler. This issue was raised as a bug for the compiler (which is C-coded). I'd be very happy for this issue to be closed as 'not a bug

[issue46910] Expect IndentationError, get SyntaxError: 'break' outside loop

2022-03-04 Thread Jonathan Fine
Jonathan Fine added the comment: Many thanks Pablo for the clear explanation. I'd prefer that the issue remain open, as there's an important user experience issue here. I suspect there are other similar examples of how the compiler error messages could be improved. Here's a change

[issue46910] Expect IndentationError, get SyntaxError: 'break' outside loop

2022-03-03 Thread Jonathan Fine
New submission from Jonathan Fine : This arises from a request for help made by Nguyễn Ngọc Tiến to the visually impaired programmers lists, see https://www.freelists.org/post/program-l/python,48. Please keep this in mind. Nguyễn asked for help with the syntax error created by === count = 0

[issue44623] help(open('/dev/zero').writelines) gives no help

2021-07-13 Thread Jonathan Fine
Jonathan Fine added the comment: I used my default Python, which is Python 3.6. However, with 3.7 and 3.8 I get the same as Paul. So I'm closing this as 'not a bug' (as there's not an already-fixed option for closing). -- resolution: works for me -> not a bug status: pend

[issue44623] help(open('/dev/zero').writelines) gives no help

2021-07-13 Thread Jonathan Fine
New submission from Jonathan Fine : On Linux >>> help(open('/dev/zero').writelines) gives However https://docs.python.org/3/library/io.html#io.IOBase.writelines gives Write a list of lines to the stream. Line separators are not added, so it is usual for each of the lines provide

[issue40028] Math module method to find prime factors for non-negative int n

2020-03-21 Thread Jonathan Fine
Jonathan Fine added the comment: A pre-computed table of primes might be better. Of course, how long should the table be. There's an infinity of primes. Consider >>> 2**32 4294967296 This number is approximately 4 * (10**9). According to https://en.wikipedia.org/wiki/Prime_numbe

[issue16385] evaluating literal dict with repeated keys gives no warnings/errors

2019-03-11 Thread Jonathan Fine
Jonathan Fine added the comment: This is was closed and tagged as resolved in 2012. The status has not been changed since then. Using dict(a=1, ...) provides a workaround, but only when the keys are valid as variable names. The general workaround is something like helper([ (1

[issue16385] evaluating literal dict with repeated keys gives no warnings/errors

2019-03-06 Thread Jonathan Fine
Jonathan Fine added the comment: I mention this issue, and related pages, in [Python-ideas] dict literal allows duplicate keys https://mail.python.org/pipermail/python-ideas/2019-March/055717.html It arises from a discussion of PEP 584 -- Add + and - operators to the built-in dict class

[issue26910] dictionary literal should not allow duplicate keys

2019-03-06 Thread Jonathan Fine
Jonathan Fine added the comment: I mention this issue, and related pages, in [Python-ideas] dict literal allows duplicate keys https://mail.python.org/pipermail/python-ideas/2019-March/055717.html It arises from a discussion of PEP 584 -- Add + and - operators to the built-in dict class

[issue35857] Stacktrace shows lines from updated file on disk, not code actually running

2019-01-30 Thread Jonathan Fine
Jonathan Fine added the comment: For information - all taken from docs and Lib/*.py https://docs.python.org/3.7/library/traceback.html traceback -- Print or retrieve a stack traceback Source code: Lib/traceback.py === This module provides a standard interface to extract, format and print stack

[issue35857] Stacktrace shows lines from updated file on disk, not code actually running

2019-01-30 Thread Jonathan Fine
Jonathan Fine added the comment: The problem, as I understand it, is a mismatch between the code object being executed and the file on disk referred to by the code object. When a module is reloaded it is first recompiled, if the .py file is newer than the .pyc file. (I've tested

[issue35698] [statistics] Division by 2 in statistics.median

2019-01-14 Thread Jonathan Fine
Jonathan Fine added the comment: I'm still thinking about this. I find Steve's closing of the issue premature, but I'm not going to reverse it. -- ___ Python tracker <https://bugs.python.org/issue35

[issue35698] Division by 2 in statistics.median

2019-01-10 Thread Jonathan Fine
Jonathan Fine added the comment: It might be better in my sample code to write isinstance(p, int) instead of type(p) == int This would fix Rémi's example. (I wanted to avoid thinking about (False // True).) For median([1, 1]), I am not claiming that 1.0 is wrong and 1 is right. I'm

[issue35698] Division by 2 in statistics.median

2019-01-10 Thread Jonathan Fine
Jonathan Fine added the comment: Here's the essence of a patch. Suppose the input is Python integers, and the output is a mathematical integer. In this case we can make the output a Python integer by using the helper function >>> def wibble(p, q): ... if type(p) == type(q) ==

[issue35698] Division by 2 in statistics.median

2019-01-10 Thread Jonathan Fine
Jonathan Fine added the comment: I read PEP 450 as saying that statistics.py can be used by "any secondary school student". This is not true for most Python libraries. In this context, the difference between a float and an int is important. Consider statistics.medi

[issue35698] Division by 2 in statistics.median

2019-01-09 Thread Jonathan Fine
New submission from Jonathan Fine : When len(data) is odd, median returns the average of the two middle values. This average is computed using i = n//2 return (data[i - 1] + data[i])/2 This results in the following behaviour >>> from fractions import Fraction

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

2019-01-07 Thread Jonathan Fine
Jonathan Fine added the comment: Based on a quick review of the python docs, the bug report, PEP 450 and this thread, I suggest 1. More carefully draw attention to the NaN feature, in the documentation for existing Python versions. 2. Consider revising statistics.py so that it raises

[issue34431] Docs does not eval allows code object as argument

2019-01-07 Thread Jonathan Fine
Jonathan Fine added the comment: This graceful reminder is most welcome. At present, it's not help I'm short of, but time. I've given myself a reminder, to spend time on this before the end of this month (January 2019). Once again, thank you for this reminder. This is something I want to do

[issue34464] docs: keywords are special - eg constants.html

2018-08-22 Thread Jonathan Fine
Jonathan Fine added the comment: I'm happy to work on improving the text here. I'm new to contributing to Python. I'm being mentored to work on #34431. Once I'm done with that, I'll be better placed to contributed to this issue. -- ___ Python

[issue34464] docs: keywords are special - eg constants.html

2018-08-22 Thread Jonathan Fine
New submission from Jonathan Fine : The identifiers True, False, None and __debug__ are keywords in the language. For example >>> __debug__ = __debug__ SyntaxError: assignment to keyword 1. The page constants.html incorrectly says then are in the built-in namespace. Some of them w

[issue34452] docs: help text for [>>>] toggle always in English

2018-08-21 Thread Jonathan Fine
Jonathan Fine added the comment: Thank you. I've raised "The help text for [>>>] toggle always in English" https://github.com/python/python-docs-theme/issues/23 -- ___ Python tracker <https://bugs

[issue34452] docs: help text for [>>>] toggle always in English

2018-08-21 Thread Jonathan Fine
New submission from Jonathan Fine : As subject. Background information in #34451. See https://docs.python.org/fr/3/tutorial/introduction.html The hover help text for the [>>>] is in English, not French. Korean and Japanese documentation has the same problem. -- assignee: do

[issue34451] docs: tutorial/introduction doesn't mention toggle of prompts

2018-08-21 Thread Jonathan Fine
New submission from Jonathan Fine : Interactive code examples need the prompt to be stripped, before copy-and-paste. This is explained in https://docs.python.org/3/tutorial/introduction.html But this page does not tell us about the [>>>] prompt-toggle at top of each interactive cod

[issue34431] Docs does not eval allows code object as argument

2018-08-18 Thread Jonathan Fine
Jonathan Fine added the comment: OK. I'll do as you say. I've just signed the CLA. -- ___ Python tracker <https://bugs.python.org/issue34431> ___ ___ Python-bug

[issue34431] Docs does not eval allows code object as argument

2018-08-18 Thread Jonathan Fine
Jonathan Fine added the comment: Summary: There's my problem, and others. I'm willing to provide a patch, if supported. There's a gotcha here. I fell into it. The docs for eval state === eval(expression, globals=None, locals=None) The arguments are a string and optional globals and locals

[issue34431] Docs does not eval allows code object as argument

2018-08-18 Thread Jonathan Fine
New submission from Jonathan Fine : See https://docs.python.org/3.6/library/functions.html#eval This says the following won't happen. But it does. Python 3.6.2 (default, Jul 29 2017, 00:00:00) [GCC 4.8.4] on linux Type "help", "copyright", "credits" or "lic

[issue34398] Docs search does not index glossary items

2018-08-15 Thread Jonathan Fine
Jonathan Fine added the comment: Thank you for this, Ammar. Proof of concept solution is good progress. I'm well impressed. The screen shots convince me that it's well worth doing. For me, the one thing that's missing is a link just above the glossary item. Something like "Glo

[issue34398] Docs search does not index glossary items

2018-08-15 Thread Jonathan Fine
Jonathan Fine added the comment: You're right! Thank you. However, there's still a problem. A user searches for a technical term, and the carefully written glossary entry defining it does not appear. For my search term (iterable), there was a single entry with a link to the Glossary page

[issue34398] Docs search does not index glossary

2018-08-14 Thread Jonathan Fine
Jonathan Fine added the comment: Good discovery. The glossary uses the RST glossary directive. https://github.com/python/cpython/blob/master/Doc/glossary.rst The Sphinx docs have a glossary, which is indexed by its search. http://www.sphinx-doc.org/en/master/search.html?q=domain So maybe

[issue34398] Docs search does not index glossary

2018-08-14 Thread Jonathan Fine
New submission from Jonathan Fine : The docs contain a very useful page https://docs.python.org/3.5/glossary.html. However, the search feature does not index the glossary. Thus, the search https://docs.python.org/3.5/search.html?q=iterable does not produce the helpful glossary entry

[issue34237] faq/design: PEP 572 adds assignment expressions

2018-07-27 Thread Jonathan Fine
Jonathan Fine added the comment: I'm sorry. I apologise. I'm being a bit stupid. Everything is fine. Nothing to do. In case you care, here's the situation. Python 3.8 is in development, and not yet released. Somehow, I'd got it into my mind that it had already been released. So the PEP

[issue34237] faq/design: PEP 572 adds assignment expressions

2018-07-27 Thread Jonathan Fine
Jonathan Fine added the comment: First, I'm delighted that the current docs are in fact correct regarding assignment expressions. (I should have said this earlier.) I'm happy to wait for the implementation to land. (And if you like, I'm willing to help with the documentation. I seem to have

[issue34237] faq/design: PEP 572 adds assignment expressions

2018-07-27 Thread Jonathan Fine
Jonathan Fine added the comment: My mistake. But not mine only. According to https://www.python.org/dev/peps/pep-0572/ the PEP is Python-Version: 3.8 I took this to mean that it had been implemented in Python 3.8. Reading the PEP more closely, it also says Status: Accepted. According

[issue25461] Unclear language (the word ineffective) in the documentation for os.walk

2018-07-26 Thread Jonathan Fine
Change by Jonathan Fine : -- nosy: +jfine2358 ___ Python tracker <https://bugs.python.org/issue25461> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue34237] faq/design: PEP 572 adds assignment expressions

2018-07-26 Thread Jonathan Fine
New submission from Jonathan Fine : The title says it all. faq/design: PEP 572 adds assignment expressions https://docs.python.org/3.8/faq/design.html#why-can-t-i-use-an-assignment-in-an-expression [Can't use] this C idiom: while (line = readline(f)) { // do something with line } https