On Tue, Jul 01, 2014 at 09:58:37AM -0700, Nick Coghlan wrote:
On 1 July 2014 01:27, Andrew Barnert firstname.lastname@example.org wrote:
But CPython does expose bytecode via the dis module, parts of inspect, etc. [...]
Note that the dis module has a "CPython implementation detail" disclaimer, and the AST structure is deliberately exempted from the usual backwards compatibility guarantees.
Further to what Nick says, the *output* of dis is not expected to remain backwards compatible from version to version, only the dis API itself.
There's a big difference between saying "we guarantee that the dis module will correctly and accurately disassemble valid bytecode", and saying "we guarantee that this specific chunk of bytecode will do these things". In order to use a hypothetical asm function, you need to know what pseudo-assembly to write, say `asm [SPAM, EGGS]`. That means that SPAM and EGGS must be stable and part of the language definition. (Or at least part of the CPython API.) That's a big step from the current situation.