Skip to content

Instantly share code, notes, and snippets.

@vivainio
Last active January 4, 2016 02:49
Show Gist options
  • Save vivainio/8558162 to your computer and use it in GitHub Desktop.
Save vivainio/8558162 to your computer and use it in GitHub Desktop.

Reason to use future import (both examples in python 2).

Without import:

In [1]: print(1,2)
(1, 2)

With import

In [2]: from __future__ import print_function

In [3]: print(1,2)
1 2
@edreamleo
Copy link

Nice. Each file must have its own "from future" statements because such statements must preceded import statements: http://docs.python.org/2/reference/simple_stmts.html#future

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment