Why not allow empty code blocks?

Chris Angelico rosuav at gmail.com
Sat Jul 30 08:44:58 EDT 2016


On Sat, Jul 30, 2016 at 10:31 PM, Rustom Mody <rustompmody at gmail.com> wrote:
> What makes you think I wanted to print those numbers??
> Maybe I wanted a list of 10 None-s??

Because you NEVER SAID what you wanted! How can you talk about error
detection if you won't say what the programmer's intention was? You're
forcing us to guess, and then complaining that I guessed wrongly.

> Point being that when one mixes up 2 things like that its anybody’s guess
> which is the primary (central) effect and which the ‘side’ effect

Okay, so my revised guess is: Console output is a primary effect and
should not have a secondary effect of returning None. Great. Now
please go and build yourself a language in which list.append is a
statement (because it shouldn't return None either), etc, etc, just in
case someone uses them wrongly. I'll keep using Python, where it's
normal for a side-effect-y function to return None - it's much
simpler. And even in Pike, where void functions are a real thing, it's
possible to recast the function so you can call it in an expression
context - and the same thing happens. Truly void functions are nothing
but parser convenience.

ChrisA



More information about the Python-list mailing list