> Any stdlib AST optimiser would need to be substantially more conservative by default.
FYI The test suite of Python 2.7 and 3.3 pass with astoptimizer... except some "minor" (?) failures:
* test_math fails for the reason explained above
* test_pdb: it looks to be an issue with line number (debuggers don't like optimizers :-))
* test_xml_etree and test_xml_etree_c: reference count of the None singleton
The test suite helped me to find bugs in my optimizer :-)
I also had to add some hacks (hasattr) for test_ast (test_ast generates invalid AST trees). The configuration should also be adapted for test_peepholer, because CPython peepholer uses a limit of 20 items, whereas astoptimizer uses a limit of 4096 bytes/characters for string by default. All these minor nits are now handled in a specific "cpython_tests" config.