#python #scip

Function notation has three principal advantages over the mathematical convention of infix notation. First, functions may take an arbitrary number of arguments:

 >>> max ( 1 , - 2 , 3 , - 4 ) 3

No ambiguity can arise, because the function name always precedes its arguments.

Second, function notation extends in a straightforward way to nested expressions, where the elements are themselves compound expressions. In nested call expressions, unlike compound infix expressions, the structure of the nesting is entirely explicit in the parentheses.

 >>> max ( min ( 1 , - 2 ), min ( pow ( 3 , 5 ), - 4 )) -2

There is no limit (in principle) to the depth of such nesting and to the overall complexity of the expressions that the Python interpreter can evaluate. However, humans quickly get confused by multi-level nesting. An important role for you as a programmer is to structure expressions so that they remain interpretable by yourself, your programming partners, and other people who may read your expressions in the future.

Third, mathematical notation has a great variety of forms: multiplication appears between terms, exponents appear as superscripts, division as a horizontal bar, and a square root as a roof with slanted siding. Some of this notation is very hard to type! However, all of this complexity can be unified via the notation of call expressions. While Python supports common mathematical operators using infix notation (like + and - ), any operator can be expressed as a function with a name.

If you want to change selection, open document below and click on "Move attachment"

1.2 Elements of Programming
order of the arguments in a call expression matters. For instance, the function pow raises its first argument to the power of its second argument. >>> pow(100, 2) 10000 >>> pow(2, 100) 1267650600228229401496703205376 <span>Function notation has three principal advantages over the mathematical convention of infix notation. First, functions may take an arbitrary number of arguments: >>> max(1, -2, 3, -4) 3 No ambiguity can arise, because the function name always precedes its arguments. Second, function notation extends in a straightforward way to nested expressions, where the elements are themselves compound expressions. In nested call expressions, unlike compound infix expressions, the structure of the nesting is entirely explicit in the parentheses. >>> max(min(1, -2), min(pow(3, 5), -4)) -2 There is no limit (in principle) to the depth of such nesting and to the overall complexity of the expressions that the Python interpreter can evaluate. However, humans quickly get confused by multi-level nesting. An important role for you as a programmer is to structure expressions so that they remain interpretable by yourself, your programming partners, and other people who may read your expressions in the future. Third, mathematical notation has a great variety of forms: multiplication appears between terms, exponents appear as superscripts, division as a horizontal bar, and a square root as a roof with slanted siding. Some of this notation is very hard to type! However, all of this complexity can be unified via the notation of call expressions. While Python supports common mathematical operators using infix notation (like + and - ), any operator can be expressed as a function with a name. 1.2.3 Importing Library Functions Python defines a very large number of functions, including the operator functions mentioned in the preceding section, but does not make all o