Re: =- and -= snag

2023-03-15 Thread Morten W. Petersen
I don't remember making such a mistake ever before, but it might have happened. -= is a convenient operator so I've probably used it a lot. Anyway, I found that flake8 flagged this as E225 missing whitespace around operator and it's the only linter of pylint, flake8 and pyflake that detects

Re: =- and -= snag

2023-03-14 Thread aapost
On 3/14/23 18:50, Rob Cliffe wrote: On 14/03/2023 21:28, avi.e.gr...@gmail.com wrote: Type hints are actually situationally quite useful (though yes, kind of hard to understand when you first come across their use, largely because of things like Union). And I wouldn't recommend their use

Re: =- and -= snag

2023-03-14 Thread rbowman
On Tue, 14 Mar 2023 22:15:34 GMT, Gilmeh Serda wrote: > On Mon, 13 Mar 2023 22:26:20 +0100, Morten W. Petersen wrote: > >> numbers for calculations didn't add up. It went into negative numbers, >> when that shouldn't have been possible. > > We have all written code that makes us wonder why the

Re: =- and -= snag

2023-03-14 Thread Keith Thompson
"Morten W. Petersen" writes: > 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

Re: =- and -= snag

2023-03-14 Thread Rob Cliffe via Python-list
On 14/03/2023 21:28, avi.e.gr...@gmail.com wrote: TThere are people now trying to in some ways ruin the usability by putting in type hints that are ignored and although potentially helpful as in a linter evaluating it, instead often make it harder to read and write code if required to use

RE: =- and -= snag

2023-03-14 Thread avi.e.gross
, freedom is relative and after you have been mugged a few times by your errors, you may decide it is worth getting some protection. So, consider having code reviews where fresh eyes may spot your errors. -Original Message- From: Python-list On Behalf Of Morten W. Petersen Sent

Re: =- and -= snag

2023-03-14 Thread Morten W. Petersen
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

Re: =- and -= snag

2023-03-14 Thread Jon Ribbens via Python-list
On 2023-03-13, Morten W. Petersen 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 -=. > >

Re: =- and -= snag

2023-03-14 Thread aapost
On 3/13/23 17:26, Morten W. Petersen wrote: 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? That is why I tell Alice it is always best to stay

Re: =- and -= snag

2023-03-13 Thread Thomas Passin
On 3/13/2023 9:47 PM, Chris Angelico wrote: On Tue, 14 Mar 2023 at 12:38, Thomas Passin 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

Re: =- and -= snag

2023-03-13 Thread Chris Angelico
On Tue, 14 Mar 2023 at 12:38, Thomas Passin 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. > > >

Re: =- and -= snag

2023-03-13 Thread Thomas Passin
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

RE: =- and -= snag

2023-03-13 Thread avi.e.gross
problem of a hard to find bug because it LOOKS RIGHT to you. But it is what it is. Avi -Original Message- From: Python-list On Behalf Of Morten W. Petersen Sent: Monday, March 13, 2023 5:26 PM To: python-list Subject: =- and -= snag Hi. I was working in Python today, and sat there scr

Re: =- and -= snag

2023-03-13 Thread MRAB
On 2023-03-14 00:28, Gary Herron wrote: On 3/13/23 2:26 PM, morp...@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

Re: =- and -= snag

2023-03-13 Thread Chris Angelico
On Tue, 14 Mar 2023 at 11:37, Gary Herron wrote: > > > On 3/13/23 2:26 PM, morp...@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

Re: =- and -= snag

2023-03-13 Thread Gary Herron
On 3/13/23 2:26 PM, morp...@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 -=.

=- and -= snag

2023-03-13 Thread Morten W. Petersen
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