Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Chris Angelico Newsgroups: comp.lang.python Subject: Re: Question about output different with command dis.dis(code) Date: Thu, 26 Nov 2015 20:09:30 +1100 Lines: 16 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de NRh16Sh+my5kMfrDr1rpJAMdzs6R2mDDSThM2gNbT5YA== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'received:209.85.223': 0.03; 'heavily': 0.04; 'run-time': 0.05; 'subject:Question': 0.05; 'compile-time': 0.07; 'subject:code': 0.07; 'cc:addr:python-list': 0.09; 'subject:command': 0.09; 'python': 0.10; 'language,': 0.11; 'output': 0.13; 'interpreter': 0.15; 'thu,': 0.15; 'different?': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'jython,': 0.16; 'quoted': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'byte': 0.18; 'of.': 0.18; 'input': 0.18; 'versions': 0.20; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'thus': 0.24; 'header:In-Reply- To:1': 0.24; 'all.': 0.24; 'switch': 0.27; 'message- id:@mail.gmail.com': 0.27; 'code': 0.30; 'received:google.com': 0.35; 'involving': 0.35; 'nov': 0.35; 'something': 0.35; 'but': 0.36; 'instead': 0.36; 'there': 0.36; 'received:209.85': 0.36; '(and': 0.36; 'depends': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'difference': 0.38; 'received:209': 0.38; 'anything': 0.38; 'building': 0.38; 'subject:with': 0.40; 'some': 0.40; 'different': 0.63; 'great': 0.63; '26,': 0.72; 'construction': 0.72; 'chrisa': 0.84; 'to:none': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=AVjV+WvZ3rpg+IuLCrg1xXJUzjkGvJUV2zQ6Z/FiABk=; b=GXujK6Xb4elF1PMZTxm55rm05lCRIXcIk5qQKGAK72uEAJ9VZvSI6Y62AIu3R91fNH T+Y9tPhPrUf5zkTkkMmjqAjhKjqMeBJuF27CXdcgh6q+bpCfs4Zoit1IyFZTe9+uU4Yi uuNhhwzTKHwjia8RoWnHfea66SBqMKmdeWvKIt2/CwB77le/+0N73iOonGTDSDKHHX4N 8NEnlKpD/AQu0SvhDcdE5onSxsrFts77q4MWMCd8c0ejzfGrWB96zd09D6YfQHjPbyFL 5/25E45fXOQoapEUuBi0V4ErGedjeyXOm4PLjAjDwYtzpXnY7UxswZPvavSslQC+oYsY Zfiw== X-Received: by 10.107.16.84 with SMTP id y81mr36818853ioi.19.1448528970116; Thu, 26 Nov 2015 01:09:30 -0800 (PST) In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:99548 On Thu, Nov 26, 2015 at 8:02 PM, fl 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