LinExpr.size()

size ( )

Retrieve the number of terms in the linear expression (not including the constant).

Return value:

Number of terms in the expression.

Example usage:

  e = x + 2 * y + 3
  print(e.size())