-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add support for 'sep' and 'end' kwonlyargs in 'print'. #113
base: master
Are you sure you want to change the base?
Conversation
sep = rte_lookup_locals(rte, 'sep') | ||
end = rte_lookup_locals(rte, 'end') | ||
|
||
if not (om_isinstance(sep, class_str) or om_isinstance(sep, class_NoneType)): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's faster to do om_is(sep, om_None)
since None
is a singleton.
return sem_raise_with_message(ctx, class_TypeError, "end must be None or a string") | ||
|
||
sep = OM_get_boxed_value(sep) | ||
end = OM_get_boxed_value(end) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Careful, at this point, sep
and end
could be om_None
in your code.
@@ -7290,7 +7303,7 @@ def print_value(rte, str_result): | |||
if args_len > 0: | |||
return loop(rte, 0) | |||
else: | |||
runtime_print('', rte) | |||
runtime_print('' + end, rte) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
runtime_print(end, rte)
should do the trick
I think we should also add tests |
This draft proposes an implementation of
sep
andend
keyword args inprint
statements.Works on the online REPL, need to figure out how to test this functionality.