Tuesday 10 July 2018

Python Tips

Cited from the book "Python How to Program"

python -i program.py enters interactive mode after execution completion.

from __future__  import division
'/' : true division
'//': floor division

An expression containing and or or operators is evaluated until its truth or falsity is known. This is called short circuit evalutation.

Normally, control passes through the statement. If a print statement includes a function call without parentheses, it displays the memory location of the function. If the user intends to assign the result of a function call to a variable, a function call without parentheses binds the function itself to the variable.

No comments:

Post a Comment