=- and -= snag

Gary Herron gherron at digipen.edu
Mon Mar 13 20:28:16 EDT 2023


On 3/13/23 2:26 PM, morphex at gmail.com wrote:
> Hi.
>
> 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?
>
> Regards,
>
> Morten
>

These all mean the same thing, but I don't see a good way to designate 
the second or third as an error.


x = -5
x=-5
x =- 5


Dr. Gary Herron
Professor of Computer Science
DigiPen Institute of Technology



More information about the Python-list mailing list