[Python-ideas] Framework for Python for CS101
Chris Angelico
rosuav at gmail.com
Tue May 26 08:07:40 CEST 2015
On Tue, May 26, 2015 at 3:54 PM, Terry Reedy <tjreedy at udel.edu> wrote:
> 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.
That's fine as long as it's okay to produce no results whatsoever
until all processing is complete. In a pure sense, yes, a program's
goal is to produce output, and it doesn't make a lot of difference how
that output is produced. You can build a web framework in which the
only way to send a result is to return it from a function. But there
are innumerable times when it's more useful to produce intermediate
output; whether that output goes to a file, a socket, the console, or
something else, it's as much a part of real-world programming as
returned values are.
Doesn't the Zen of Python say something about practicality and purity? Hmmm.
ChrisA
More information about the Python-ideas
mailing list