[Ironpython-users] Separating return values from printed values?

Doug Blank doug.blank at gmail.com
Thu Sep 20 06:43:03 CEST 2012


IronPython users,

Interesting question: we have IronPython embedded in a nice little
educational GUI, and have the DLR output sent to our text output
window where we can control the font color, etc.

In teaching CS, it is always hard to try to get across the difference
between a "return value" and a "displayed string". For example:

>>> 22
22
>>> print(23)
23
>>> function()
22

where 22 is just a value, and 23 is a displayed string (a side-effect
for you functional types). These GUIs don't make it easy to see the
difference.

One thing we've thought about is making a distinction between them
with color, such that 22 might be blue, and 23 would be green.

Can you think of an easy way to do that with IronPython and the DLR?
Anything we could tap into to send evaluations one way, and displayed
values another?

Thanks for any suggestions,

-Doug


More information about the Ironpython-users mailing list