On 5/25/2015 10:56 PM, Rustom Mody wrote:
It would be rather ridiculous to remove the print from a realistic language. However if you've taught enough beginners you'd know how hard it is to get beginners to write ... return <something> as against ... print (<something>)
Programming is composition, the connections of outputs to inputs (as with circuit design). 'Print' is the enemy of composition. We agree so far. If submitting code with 'print' instead of 'return' gets a grade of 0 or 'fail', don't people learn fairly quickly? If assignments are partially test-defined and automatically test-graded, 'print' rather than 'return' will fail. Example: 'write a function that returns a tuple of the number of positive and negative values in an finite iterable of signed numbers', followed by examples with the caveat that the grading test will have other inputs and expected outputs.
And so in an early teachpack, I'd disable the print statement.
Print is essential for debugging. You should only want to disallow print in the final submission of function code, as suggested above. -- Terry Jan Reedy