Printing a tuple with a single item

@piac I noticed something odd when using either the __future__ print function or regular print function with a comma at the end - it looks like the GhPython component does not ‘flush’ its print output if it does not end with a new line, and then accumulates the unprinted text between solutions:

Not sure if this is a Mac specific issue?

This is the same on Windows. Let me have a look.

(I moved this to a new discussion)

Logged as RH-45787.

Hi @qythium

It took some time to come back to this, but I’ve debugged and realized that this is a feature of Python 2. Python 2 uses the special comma syntax (it’s not printing a tuple here) to indicate not to add a new line, but to add to the current printing line. However, we cache single char writes for speed. That means, that you’ll have to add a single print() at the end to flush the buffer and actually see the line.

I hope this helps someone. Thanks,

Giulio


Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com