segmentation.evaluation icon indicating copy to clipboard operation
segmentation.evaluation copied to clipboard

assert len(window) is window_size + 1 for equal numbers

Open janrygl opened this issue 8 years ago • 1 comments

Hello,

I would like to report wrong usage of assert x is y line:

https://github.com/cfournie/segmentation.evaluation/blob/master/segeval/window/windowdiff.py

line 110

assert len(window) is window_size + 1

fails.

It should be enough to have

assert len(window) == window_size + 1

Examples (python2.7.6):

>>> assert 3 is 2 + 1
>>> assert 300 is 299 + 1
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AssertionError
>>> id(300)
17688624
>>> id(299 + 1)
17688456
>>> id(1 + 299)
17688600

janrygl avatar May 29 '16 17:05 janrygl

https://stackoverflow.com/a/2239753/3447343

michal-au avatar Oct 24 '19 13:10 michal-au