Just a couple of days ago I was asking myself a similar question, and found this blog article: https://jeffknupp.com/blog/2013/02/14/drastically-improve-your-python-understanding-pythons-execution-model/
Clarified a lot of things to me. , Anton > On 17 Nov 2016, at 16:19, BartC <b...@freeuk.com> wrote: > >> On 17/11/2016 12:20, Steve D'Aprano wrote: >> On Thu, 17 Nov 2016 10:37 pm, BartC wrote: > >>> (I don't know how to disassemble code outside a function, not from >>> inside the same program. Outside it might be: 'python -m dis file.py') > >> In the most recent versions of Python, dis.dis() will also accept a string: >> >> py> dis.dis('y = x + 1') >> 1 0 LOAD_NAME 0 (x) >> 3 LOAD_CONST 0 (1) >> 6 BINARY_ADD >> 7 STORE_NAME 1 (y) >> 10 LOAD_CONST 1 (None) >> 13 RETURN_VALUE > > > Py2 gave me (for "y=x+1"): > > 0 SETUP_EXCEPT 30781 (to 30784) > 3 STORE_SLICE+3 > 4 <49> > > Py3.4 works as you say but after that result I was disinclined to take it > further! > > -- > Bartc > -- > https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list