Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

'print' statement ignores >> operator #289

Open
alanjds opened this issue Apr 22, 2017 · 2 comments
Open

'print' statement ignores >> operator #289

alanjds opened this issue Apr 22, 2017 · 2 comments

Comments

@alanjds
Copy link
Contributor

alanjds commented Apr 22, 2017

The print statement is ignoring the >> keyword:

This test script outputs AssertionError: 0 chars printed, instead of 3, after printing 'foo' in the stdout.

import StringIO

fake_stdout = StringIO.StringIO()

print >> fake_stdout, 'foo',
chars = fake_stdout.tell()
assert chars == 3, '%s chars printed, instead of 3' % chars
@alanjds alanjds changed the title print() ignores >> operator 'print' statement ignores >> operator Apr 22, 2017
@trotterdylan
Copy link
Contributor

This should be pretty straightforward to support:

  1. Add an arg to Print() that is the object to output to (default will be nil).

  2. Add code to visit_Print() that will pass the dest attribute of the Print node to grumpy.Print() in the generated code.

@alanjds
Copy link
Contributor Author

alanjds commented Apr 23, 2017

Nice. Will pursue this, as is needed to ease the code to test #223.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants