=- and -= snag

Morten W. Petersen morphex at gmail.com
Tue Mar 14 16:30:53 EDT 2023


Hoi.

After reading the replies, I think some script / linter etc. is the right
thing to do. What's the best linter for Python out there that covers this
as well?

At first glance I thought =- was a new assignment operator, and this is
what seemed unpythonic to me, to have two operators that were so similar.

-Morten

On Tue, Mar 14, 2023 at 5:31 PM Jon Ribbens via Python-list <
python-list at python.org> wrote:

> 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...)
> --
> https://mail.python.org/mailman/listinfo/python-list
>


-- 
I am https://leavingnorway.info
Videos at https://www.youtube.com/user/TheBlogologue
Twittering at http://twitter.com/blogologue
Blogging at http://blogologue.com
Playing music at https://soundcloud.com/morten-w-petersen
Also playing music and podcasting here:
http://www.mixcloud.com/morten-w-petersen/
On Google+ here https://plus.google.com/107781930037068750156
On Instagram at https://instagram.com/morphexx/


More information about the Python-list mailing list