tenpy.tools.misc.add_with_None_0(a, b)[source]

Return a + b, treating None as zero.

Parameters

b (a,) – The two things to be added, or None.

Returns

a + b, except if a or b is None, in which case the other variable is returned.

Return type

sum