'None' is not displayed as I expected in Python interactive mode -
i thought display in python interactive mode equivalent print(repr()), not none. language feature or missing something? thank you
>>> none >>> print(repr(none)) none >>>
yes, behaviour intentional.
from python docs
7.1. expression statements
expression statements used (mostly interactively) compute , write value, or (usually) call procedure (a function returns no meaningful result; in python, procedures return value
none). other uses of expression statements allowed , useful. syntax expression statement is:expression_stmt ::= starred_expressionan expression statement evaluates expression list (which may single expression).
in interactive mode, if value not
none, converted string using built-inrepr()function , resulting string written standard output on line (except if resultnone, procedure calls not cause output.)
Comments
Post a Comment