On 28 juil, 17:39, Ethan Furman <et...@stoneleaf.us> wrote:
>
> --> bool(0) is bool(0)
> True
>

This test is not reliable - a same id can be reused for terms (I have
already seen such things happening). If you want a reliable test, use:

#> a = bool(0)
#> b = bool(0)
#> a is b
True

Note that this still fails to prove anything since bool is a subclass
of int and CPython caches "small" integers:

#> a = 42
#> b = 42
#> a is b
True





-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to