=- and -= snag

Jon Ribbens jon+usenet at unequivocal.eu
Tue Mar 14 08:31:02 EDT 2023


On 2023-03-13, Morten W. Petersen <morphex at gmail.com> wrote:
> I was working in Python today, and sat there scratching my head as the
> numbers for calculations didn't add up.  It went into negative numbers,
> when that shouldn't have been possible.
>
> Turns out I had a very small typo, I had =- instead of -=.
>
> Isn't it unpythonic to be able to make a mistake like that?

Why would it be? How could it be? Mandating white-space between
operators would be unpythonic.

That's nothing anyway - yesterday I had an issue in TypeScript which
confused me for a while which turned out to be because 1 + 1 = 11.
(I thought the whole point of TypeScript was to prevent things like
that...)


More information about the Python-list mailing list