I have tried and errored a reasonable amount of times
Chris Angelico
rosuav at gmail.com
Sun Aug 31 05:16:14 EDT 2014
On Sun, Aug 31, 2014 at 6:37 PM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> - Use print() to see the intermediate results:
>
> a = e[0].isupper
> print(e[0], a, a == False, a == True)
And I'll add to this: *Copy and paste* the original code to craft this
output statement. I recently was trying to figure out a problem, and
retyped to create the output statements... and I didn't make the same
typo, so it worked fine. For some reason, my eye didn't notice the
error, and I couldn't understand why the intermediate results were
correct and the overall result was wrong. (And no, it wasn't the kind
of 'wrong' that results in a nice tidy exception. It just resulted in
wrong results.)
ChrisA
More information about the Python-list
mailing list