Le 20/06/2020 à 18:23, Stefan Ram a écrit :
Boris Dorestand <bdorest...@example.com> writes:def f(y, N, k = None): k = k or (N - 1) return k I was surprised to find out that 0 == False, so f(7, 31, 0) produces 31.bool is a subtype of int.I'd like 0 to be a valid choice for k.k = N-1 if k==None else k
When comparing wih None "is" is preferred to == k = N - 1 if k is None else k -- https://mail.python.org/mailman/listinfo/python-list