[docs] Doc: remove errors about mixed-type comparisons. (issue 12067)

jimjjewett at gmail.com jimjjewett at gmail.com
Mon Oct 13 21:25:44 CEST 2014


Despite my comments suggesting further improvements, I believe it would
be helpful to commit the test case changes relatively soon.  

Refactoring (or adding) test cases at the last minute is risky, but
documentation tweaks can be made at any time -- and more people are
confident about committing them.


https://bugs.python.org/review/12067/diff/13054/Lib/test/test_compare.py
File Lib/test/test_compare.py (right):

https://bugs.python.org/review/12067/diff/13054/Lib/test/test_compare.py#newcode100
Lib/test/test_compare.py:100: class Class_none(object):
Is there a reason that these all inherit directly from object, as
opposed to ProxyCompare or something that takes care of the __init__,
and __str__ methods and documents the meth sequence?  I kept looking to
see what the differences were, and not finding any.

https://bugs.python.org/review/12067/diff/13054/Lib/test/test_compare.py#newcode123
Lib/test/test_compare.py:123: def __eq__(self, other):
Do you need some way of verifying that *this* __eq__ was called, or is
that another set of tests?

https://bugs.python.org/review/12067/diff/13054/Lib/test/test_compare.py#newcode297
Lib/test/test_compare.py:297: return False
I would like to see this simplified to do fewer isinstance checks, but
I'm not sure I should trust my intuition.

At the moment, I would do something like:

    isa1=isinstance(i1, t)
    isa2=isinstance(i2, t)
    if isa1 and isa2: ... # will do a return
    if isa1 or isa2:  return False

https://bugs.python.org/review/12067/diff/13054/Lib/test/test_compare.py#newcode325
Lib/test/test_compare.py:325: test quality; the tests do not have a
functional dependency on that.
Why not?  It does seem like something that should be explicitly tested.

Or do you just mean that that not all tests do that?  If so, adding the
word "some" up above might help.

https://bugs.python.org/review/12067/


More information about the docs mailing list