'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_expression 

an expression statement evaluates expression list (which may single expression).

in interactive mode, if value not none, converted string using built-in repr() function , resulting string written standard output on line (except if result none, procedure calls not cause output.)


Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -