Python handles globals badly.

Random832 random832 at fastmail.com
Tue Sep 15 21:54:02 EDT 2015


Steven D'Aprano <steve at pearwood.info> writes:
> I don't need to see 23 printed, because I already know what the value is, so
> that takes two lines where one would do. (On the rare case I did want to
> see the value of something I had just assigned to, I could just print the
> expression.)

Of course, you could just as well say that you _never_ need to see
anything printed unless you ask for it. The first time I used the REPL I
was irritated by the fact that None wasn't printed. The reason that None
isn't printed is, of course, because Python has no distinction between a
function that returns None as a value and a function that doesn't return
a value.

The alternative is to make assignments special within the REPL, or even
turn it into something that looks less like a REPL and more like the
variable/expression list that some IDE debuggers have.




More information about the Python-list mailing list