Skip to content
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

'print' statement ignores >> operator #138

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

'print' statement ignores >> operator #138

alanjds opened this issue Aug 18, 2018 · 2 comments

Comments

@alanjds
Copy link
Owner

alanjds commented Aug 18, 2018

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
Owner Author

alanjds commented Aug 18, 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
Owner Author

alanjds commented Aug 18, 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 #130.

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

No branches or pull requests

1 participant