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 – The two things to be added, or None.

  • b – 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