On Wed, Apr 25, 2018 at 11:53 PM, Chris Angelico <ros...@gmail.com> wrote:
> Well, true. The point isn't WHO you're dictating to, but that you can
> dictate it at all. "Hmm, let's see. Toss a 'foo colon-equals' in front
> of X, then print out what foo is." My day job involves a lot of
> helping students learn how to debug, so I say this kind of thing a lot
> (even if it's obvious to me what the problem is, because the student
> needs to learn debugging, not just be told what to fix). Refactoring
> just for the sake of a print call is overkill and potentially risky
> (if the student edits the wrong thing).

This is overstating things slightly... the best alternative to 'foo
colon-equals' isn't risky refactoring so you can call print, it's a
helper like:

def p(obj):
    print(obj)
    return obj

that you can sprinkle inside existing expressions.

Expecting new users to realize that this is possible, and a good idea,
and to implement it, and get it right, while they're in the middle of
being confused about basic python things, is not terribly reasonable,
so it's probably underused. But there are ways we could address that.

-n

-- 
Nathaniel J. Smith -- https://vorpus.org
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to