This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ChuckRhode
Recipients ChuckRhode
Date 2009-10-26.19:40:17
SpamBayes Score 4.3508036e-05
Marked as misclassified No
Message-id <1256586020.55.0.428319346967.issue7210@psf.upfronthosting.co.za>
In-reply-to
Content
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')
History
Date User Action Args
2009-10-26 19:40:20ChuckRhodesetrecipients: + ChuckRhode
2009-10-26 19:40:20ChuckRhodesetmessageid: <1256586020.55.0.428319346967.issue7210@psf.upfronthosting.co.za>
2009-10-26 19:40:18ChuckRhodelinkissue7210 messages
2009-10-26 19:40:17ChuckRhodecreate