=- and -= snag

Chris Angelico rosuav at gmail.com
Mon Mar 13 21:47:58 EDT 2023


On Tue, 14 Mar 2023 at 12:38, Thomas Passin <list1 at tompassin.net> wrote:
>
> On 3/13/2023 9:07 PM, Chris Angelico wrote:
> > Of course, all this is predicated on you actually putting whitespace
> > around your equals signs. If you write it all crunched together as
> > "x=-5", there's no extra clues to work with.
> >
> > Linters and code reviewers can make use of all the available
> > information, including whitespace, to determine programmer intent.
>
> This is the kind of thing that unit tests can catch.
>

Maybe, but that's quite orthogonal. The linter would highlight the
exact line of code with the odd whitespace; a unit test would merely
point out that the overall behaviour is incorrect, which would have
been no further information beyond what the OP already knew (the
numbers weren't adding up).

ChrisA


More information about the Python-list mailing list