add_with_None_0

  • full name: tenpy.tools.misc.add_with_None_0

  • parent module: tenpy.tools.misc

  • type: function

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

Return a + b, treating None as zero.

Parameters
a, b :

The two things to be added, or None.

Returns
sum :

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