Re: [ python-Bugs-1215887 ] String and list methods deeply hidden
SourceForge.net wrote this on Mon, Jun 06, 2005 at 11:16:19AM -0700. My reply is below. The way the docs are written makes perfect sense to me ~ now ~ but I too had difficulty navigating them at first, particularly with finding the methods of sequence types from the TOC. Eventually, I must have looked them up in the alphabetic index and backtracked to find the appropriate TOC headings. Isn't that what everyone does? I think that's what everyone should do! Not being a "C" programmer, I must refer to "2.3.6.2 String Formatting Operations" continually, and I'm not complaining that it's not buried under "2.3.6.1 String Methods." Exposing the fourth level of subtopics in section 2.3 of the lib.html document would be nice, though. -- .. Chuck Rhode, Sheboygan, WI .. http://www.excel.net/~crhode/RockyGnashtoothsWeather/ .. 72?F. Wind WSW 9 mph. Partly cloudy. ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6978] compiler.transformer dict key bug d[1,] = 1
Chuck Rhode added the comment: Here are four ways to generate things called in the documentation Abstract Syntax Trees (ASTs). Obviously they are not all the same kind of object: #!/usr/local/bin/python2.6 import sys import compiler import parser import ast STATEMENT = 'd[1,] = 2' print 'level %s' % sys.version print compiler.parse(STATEMENT) print parser.suite(STATEMENT).tolist() print ast.dump( compile(STATEMENT, '', 'exec', ast.PyCF_ONLY_AST), annotate_fields=False, include_attributes=False, ) print ast.dump( ast.parse(STATEMENT), annotate_fields=False, include_attributes=False, ) # Fin Here are the results: >>> level 2.6.2 (r262:71600, Jun 29 2009, 08:08:18) [GCC 4.3.2] >>> Module(None, Stmt([Assign([Subscript(Name('d'), 'OP_ASSIGN', [Const(1)])], >>> Const(2))])) >>> [257, [267, [268, [269, [270, [327, [304, [305, [306, [307, [308, [310, >>> [311, [312, [313, [314, [315, [316, [317, [318, [1, 'd']], [322, [9, '['], >>> [323, [324, [304, [305, [306, [307, [308, [310, [311, [312, [313, [314, >>> [315, [316, [317, [318, [2, '1', [12, ',']], [10, >>> ']', [22, '='], [327, [304, [305, [306, [307, [308, [310, >>> [311, [312, [313, [314, [315, [316, [317, [318, [2, '2']], >>> [4, '']]], [0, '']] >>> Module([Assign([Subscript(Name('d', Load()), Index(Tuple([Num(1)], >>> Load())), Store())], Num(2))]) >>> Module([Assign([Subscript(Name('d', Load()), Index(Tuple([Num(1)], >>> Load())), Store())], Num(2))]) To me the *compiler* module has vestigial utility. It would be nice if it returned correct results. -- ___ Python tracker <http://bugs.python.org/issue6978> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6978] compiler.transformer dict key bug d[1,] = 1
Chuck Rhode added the comment: > I don't see why the compiler module is any better than any of the other > ways that produce reasonable AST. It is available on Python releases older than 2.6? -- ___ Python tracker <http://bugs.python.org/issue6978> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6978] compiler.transformer dict key bug d[1,] = 1
Chuck Rhode added the comment: PythonTidy encounters this problem. o http://lacusveris.com/PythonTidy/PythonTidy.python It is unable correctly to render line 694 of test_grammar.py in the Python Test Suite: d[1,] = 2 becomes: d[1] = 2 because the *compiler* module does not return an abstract syntax tree containing a tuple for the subscript. -- nosy: +ChuckRhode ___ Python tracker <http://bugs.python.org/issue6978> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7210] Proposed Syntax Checks in Test Suite
New submission from Chuck Rhode : PythonTidy is a code beautifier written three years ago and downloaded numerous times. o http://lacusveris.com/PythonTidy/PythonTidy.python It suffers a bug, which has only recently come to light. It considers the following lines equivalent: if False is (2 is 3): pass if False is 2 is 3: pass They're not. PythonTidy handles other non-associative operators such as division correctly. I was unable to generalize from arithmetic operators to comparison operators because the Abstract Syntax Tree (AST) generated by the *compiler* module returns a different structure for them. I tested PythonTidy by running the Python Test Suite (the *test* module scripts) through it and executing the results, thought I had all my bases covered because most tests succeeded, and missed this case, so I am suggesting an amplification of the Python Test Suite for developers who may be using it for purposes other than testing Python. I wish to add these lines to the foot of *test_grammar.py*. verify(16 // (4 // 2) == 8, '16 // (4 // 2) == 8') verify((16 // 4) // 2 == 2, '(16 // 4) // 2 == 2') verify(16 // 4 // 2 == 2, '16 // 4 // 2 == 2') verify((False is (2 is 3)) == True, '(False is (2 is 3)) == True') verify(((False is 2) is 3) == False, '(((False is 2) is 3) == False') verify((False is 2 is 3) == False, '(False is 2 is 3) == False') -- components: Tests files: test_grammar.patch keywords: patch messages: 94501 nosy: ChuckRhode severity: normal status: open title: Proposed Syntax Checks in Test Suite type: feature request versions: Python 2.5 Added file: http://bugs.python.org/file15206/test_grammar.patch ___ Python tracker <http://bugs.python.org/issue7210> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7210] Proposed Syntax Checks in Test Suite
Chuck Rhode added the comment: You mean like this? -- Added file: http://bugs.python.org/file15209/test_grammar.patch ___ Python tracker <http://bugs.python.org/issue7210> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7210] Proposed Syntax Checks in Test Suite
Changes by Chuck Rhode : Removed file: http://bugs.python.org/file15209/test_grammar.patch ___ Python tracker <http://bugs.python.org/issue7210> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7210] Proposed Syntax Checks in Test Suite
Changes by Chuck Rhode : Removed file: http://bugs.python.org/file15206/test_grammar.patch ___ Python tracker <http://bugs.python.org/issue7210> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7210] Proposed Syntax Checks in Test Suite
Chuck Rhode added the comment: Well, the last two patch files weren't very good, but I hope the third time's the charm. -- Added file: http://bugs.python.org/file15210/test_grammar.patch ___ Python tracker <http://bugs.python.org/issue7210> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7210] Proposed Syntax Checks in Test Suite
Chuck Rhode added the comment: Yet another patch file -- Added file: http://bugs.python.org/file15213/test_grammar.patch ___ Python tracker <http://bugs.python.org/issue7210> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7210] Proposed Syntax Checks in Test Suite
Changes by Chuck Rhode : Removed file: http://bugs.python.org/file15213/test_grammar.patch ___ Python tracker <http://bugs.python.org/issue7210> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7210] Proposed Syntax Checks in Test Suite
Chuck Rhode added the comment: Sorry I'm having so much trouble with this patch. Here's another. Thanks for your patience. -ccr- -- Added file: http://bugs.python.org/file15231/test_grammar.patch ___ Python tracker <http://bugs.python.org/issue7210> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7210] Proposed Syntax Checks in Test Suite
Changes by Chuck Rhode : Removed file: http://bugs.python.org/file15231/test_grammar.patch ___ Python tracker <http://bugs.python.org/issue7210> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7210] Proposed Syntax Checks in Test Suite
Chuck Rhode added the comment: Oh! That's very different. :-) I can do that. -- Added file: http://bugs.python.org/file15237/test_grammar_trunk.diff ___ Python tracker <http://bugs.python.org/issue7210> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7210] Proposed Syntax Checks in Test Suite
Chuck Rhode added the comment: Thanks. -ccr- -- ___ Python tracker <http://bugs.python.org/issue7210> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com