Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #99548

Re: Question about output different with command dis.dis(code)

From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Subject Re: Question about output different with command dis.dis(code)
Date 2015-11-26 20:09 +1100
Message-ID <mailman.126.1448529727.20593.python-list@python.org> (permalink)
References <f0dc1c2c-6fda-4bd8-a71b-29db358afe14@googlegroups.com>

Show all headers | View raw


On Thu, Nov 26, 2015 at 8:02 PM, fl <rxjwg98@gmail.com> wrote:
> Are there something, my input or Python difference
> make the output different?

Anything involving the disassembly of Python code depends heavily on
internal interpreter details. You just quoted something showing that
ancient versions of Python did at run-time what current versions have
optimized to a compile-time construction (and thus the quick
LOAD_CONST instead of the full work of building the tuple). If you
switch to PyPy, Jython, IronPython, or some other implementation of
the language, the byte code may be completely different - or may not
be available at all. Using dis.dis is a great way of finding out what
is actually happening, but it's never something you can depend on the
stability of.

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Question about output different with command dis.dis(code) fl <rxjwg98@gmail.com> - 2015-11-26 01:02 -0800
  Re: Question about output different with command dis.dis(code) Random832 <random832@fastmail.com> - 2015-11-26 04:12 -0500
  Re: Question about output different with command dis.dis(code) Chris Angelico <rosuav@gmail.com> - 2015-11-26 20:09 +1100
  Re: Question about output different with command dis.dis(code) Steven D'Aprano <steve@pearwood.info> - 2015-11-27 12:28 +1100

csiph-web