Skip to content

'print' statement ignores >> operator #38

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
alanjds opened this issue Aug 21, 2018 · 2 comments
Open

'print' statement ignores >> operator #38

alanjds opened this issue Aug 21, 2018 · 2 comments
Labels
imported Imported from google/grumpy

Comments

@alanjds
Copy link

alanjds commented Aug 21, 2018

google#289 opened by @alanjds on 22 Apr 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
Copy link
Author

alanjds commented Aug 21, 2018

Comment by trotterdylan
Saturday Apr 22, 2017 at 22:44 GMT


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
Author

alanjds commented Aug 21, 2018

Comment by alanjds
Sunday Apr 23, 2017 at 03:59 GMT


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

@alanjds alanjds added the imported Imported from google/grumpy label Aug 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
imported Imported from google/grumpy
Projects
None yet
Development

No branches or pull requests

1 participant