Why does print() print an empty tuple instead of a newline?
Question: **The error was caused by a typo. Please flag this question as off-topic.**

I am having a little issue with the following lines.

    
    
    from __future__ import print_function
    print()
    

If I open up my Windows CLI and run it, it runs as expected.

[![enter image description
here](http://i.stack.imgur.com/bXcyP.png)](http://i.stack.imgur.com/bXcyP.png)

When I stick it in a program and execute it, instead of simply printing a
newline, it prints `()`.

[![enter image description
here](http://i.stack.imgur.com/MYAVz.png)](http://i.stack.imgur.com/MYAVz.png)

Has anybody run into this before?

**Additional Details:**

If I run a program with just those two lines, it runs as expected.

But for some reason, in my program `print()` prints `()`. If I replace that
line with `print(1)`, it prints `1` as it should.

Running on Windows 8 64-bit. Python 2.7.11 (v2.7.11:6d1b6a68f775)

**Minimal, complete, and verifiable example:**

    
    
    class A:
        def f(self):
            print()
    
    if __name__ == '__main__':
        a = A()
        a.f() 
    

**Final Update:**

Oh my!!!! I am an idiot.

I have a driver program that has the future import, but the class (which is
another file) does not! I do have statements like `print('abc',
file=sys.stderr)`, but they were not being executed, so the program ran no
problem.

My example above actually runs fine. The example I was running didn't have the
import. The file I was editing (otherwise an exact copy of the example) did.

Woops!!!!


Answer: [`print`](https://docs.python.org/2/reference/simple_stmts.html#the-print-
statement) is a special statement in python2.

When you do :

    
    
    from __future__ import print_function
    print()
    

You are actually calling the [print
function](https://docs.python.org/2/library/functions.html#print), which has
the same behavior as the one in python3.

In your program, you call the statement, and not the function. Hence, the
`print()` prints an empty tuple (which is indeed what `()` is).

**Additional note :**

If I add `from __future__ import print_function` at the beginning of your
example, I get a newline as expected, and not an empty tuple.

