Is this a "gotcha" in Python?

Grant Edwards grant.b.edwards at gmail.com
Mon Apr 22 10:53:58 EDT 2019


On 2019-04-20, Chris Angelico <rosuav at gmail.com> wrote:

> In this specific case, I actually think that "l" is a bad choice, but
> not because it's a single letter - more because there is a very strong
> convention of using "i" for a loop iterator, and the lowercase "l" is
> confusingly similar.

Also, in some fonts it's very diffcult to tell the difference between
"1" and "l".

Misreading or mistyping

    foo = l
as 
    foo = 1

Can result in lots of debugging fun.

The only thing worse than writing code that's hard to understand is
writing code that's easy to incorrectly understand.

Yes, there's a difference. :)

-- 
Grant Edwards               grant.b.edwards        Yow! I wonder if I should
                                  at               put myself in ESCROW!!
                              gmail.com            




More information about the Python-list mailing list