Python Byte Code Hacking

Ian Kelly ian.g.kelly at gmail.com
Wed Jul 13 20:14:51 EDT 2016


On Wed, Jul 13, 2016 at 12:48 PM, Vijay Kumar <vijaykumar at bravegnu.org> wrote:
> Hi Everyone,
> I wrote an article on Python byte code hacking. The article is available
> from http://www.bravegnu.org/blog/python-byte-code-hacks.html The article
> uses an incremental approach for explaining Python's code objects and how to
> modify them. Unfortunately, I am stuck with Python 2, because Python 2 does
> not optimize out the divide operation, at compile time, and my example
> sequence depends on that behavior.

def f():
    return g(6, 2)

def g(a, b):
    return a // b

Now it can't optimize out the operation.



More information about the Python-list mailing list