One: the order of stacking in the statement
Like other languages (C, C++, etc.), the stacking sequence is that the right end is executed first and then the stack is pushed (in python3.5). Before python2.7, the stacking sequence is the left end first.
Python2.7:
Python 2.7.10 (default, May 23 2015, 09:44:00) [MSC v.1500 64 bit (AMD64)] on wi n32 Type "help", "copyright", "credits" or "license" for more information. >>> ls = [ 1 , 2 , 3 ] >>> print ls,ls.reverse() #print is pushed to the stack first, then reverse is pushed to the stack and executed [1, 2, 3] None >>> print ls [3, 2, 1]
Python3.5:
Python 3.5.4 (v3.5.4:3f56838, Aug 8 2017, 02:17:05) [MSC v.1900 64 bit (AMD64)] on win32 Type " help " , " copyright " , " credits " or " license " for more information. >>> li = [ 4 , 3 ] >>> print(li,li.reverse()) #The right end is pushed into the stack first to execute reverse, Then output li, the result of li.reverse() is None [3, 4] None >>> print(li) [3, 4]