
March 28, 2015
11:58 p.m.
On Mar 28, 2015, at 15:45, Chris Angelico <rosuav@gmail.com> wrote:
On Sun, Mar 29, 2015 at 6:50 AM, Andrew Barnert <abarnert@yahoo.com.dmarc.invalid> wrote:
Python already has a few things you can do at runtime that affect subsequent compilation, like __future__ statements; this isn't impossible.
To be technically accurate, __future__ directives do not affect "subsequent compilation" - they affect the compilation of the one module they're at the top of, you can't do this:
def func1(f): print "Hello, world!" f("Haha")
from __future__ import print_function
def func2(): func1(print)
Except at the interactive interpreter, where you can write exactly that, and it will do exactly what you'd want/expect.