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 i

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 unpy

Re: Tkinter and cv2: "not responding" popup when imshow launched from tk app

2023-03-14 Thread aapost
On 3/14/23 06:54, John O'Hagan wrote: Hi list I'm trying to use cv2 to display images created as numpy arrays, from within a tkinter app (which does other things with the arrays before they are displayed as images). The arrays are colour-coded visualisations of genomes and can be over a billion

Re: Tkinter and cv2: "not responding" popup when imshow launched from tk app

2023-03-14 Thread John O'Hagan
On Tue, 2023-03-14 at 13:52 +, Weatherby,Gerard wrote: > Assuming you’re using opencv-python, I’d post query at > https://github.com/opencv/opencv-python/issues. Thanks Gerard I'm using the python3-opencv package from Debian testing. Is that github the appropriate place for this query? Than

Re: Tkinter and cv2: "not responding" popup when imshow launched from tk app

2023-03-14 Thread John O'Hagan
On Tue, 2023-03-14 at 08:07 -0400, Thomas Passin wrote: > On 3/14/2023 6:54 AM, John O'Hagan wrote: > > Hi list > > > > I'm trying to use cv2 to display images created as numpy arrays, > > from > > within a tkinter app (which does other things with the arrays > > before > > they are displayed as i

Re: Distributing program for Linux

2023-03-14 Thread Weatherby,Gerard
It’s really going to depend on the distribution and whether you have root access. If you have Ubuntu and root access, you can add the deadsnakes repo, https://launchpad.net/~deadsnakes, and install whatever Python you want. The default ‘python3’ remains but you can called a specific Python, (e.

Re: Debugging reason for python running unreasonably slow when adding numbers

2023-03-14 Thread Oscar Benjamin
On Tue, 14 Mar 2023 at 16:27, Alexander Nestorov wrote: > > I'm working on an NLP and I got bitten by an unreasonably slow behaviour in > Python while operating with small amounts of numbers. > > I have the following code: > > ```python > import random, time > from functools import reduce > > def

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 it

Re: Debugging reason for python running unreasonably slow when adding numbers

2023-03-14 Thread Chris Angelico
On Wed, 15 Mar 2023 at 08:53, Peter J. Holzer wrote: > > On 2023-03-14 16:48:24 +0900, Alexander Nestorov wrote: > > I'm working on an NLP and I got bitten by an unreasonably slow > > behaviour in Python while operating with small amounts of numbers. > > > > I have the following code: > [...] > >

Re: Debugging reason for python running unreasonably slow when adding numbers

2023-03-14 Thread Peter J. Holzer
On 2023-03-14 16:48:24 +0900, Alexander Nestorov wrote: > I'm working on an NLP and I got bitten by an unreasonably slow > behaviour in Python while operating with small amounts of numbers. > > I have the following code: [...] >       # 12x slower than equivalent JS >       sum_ = 0 >       for ke

RE: =- and -= snag

2023-03-14 Thread avi.e.gross
There seem to be a fundamental disconnect here based on people not understanding what can happen when spaces are optional. Yes, I have had my share of times I found what I programmed was not quite right and been unhappy but the result was mostly learning how to not not not not do that next time

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 s

Re: Debugging reason for python running unreasonably slow when adding numbers

2023-03-14 Thread Thomas Passin
On 3/14/2023 3:48 AM, Alexander Nestorov wrote: I'm working on an NLP and I got bitten by an unreasonably slow behaviour in Python while operating with small amounts of numbers. I have the following code: ```python import random, time from functools import reduce def trainPerceptron(perceptro

Re: Distributing program for Linux

2023-03-14 Thread Simon Ward
On Tue, Mar 14, 2023 at 04:43:14PM +0100, Loris Bennett wrote: If I write a system program which has Python >= 3.y as a dependency, what are the options for someone whose Linux distribution provides Python 3.x, where x < y? The docs suggest creating your own package or building and installing

Re: Running asyncio.run() more than once

2023-03-14 Thread Clint Olsen
On Monday, March 13, 2023 at 11:55:22 PM UTC-7, gst wrote: > Le mardi 14 mars 2023 à 02:32:23 UTC-4, Clint Olsen a écrit : > I'm not asyncio expert or even not advanced user, but using a simple list to > hold the jobs to execute and fill it as necessary after results gathering is > not good ? >

Running asyncio.run() more than once

2023-03-14 Thread Clint Olsen
We have an application that involves submitting hundreds to thousands of jobs to a shared computing resource, and we're using asyncio to do so because it is far less overhead than threading or multiprocessing for the bookkeeping required to keep track of all these jobs. It makes extensive use of

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 -=. > > I

Distributing program for Linux

2023-03-14 Thread Loris Bennett
Hi, If I write a system program which has Python >= 3.y as a dependency, what are the options for someone whose Linux distribution provides Python 3.x, where x < y? I am aware that an individual user could use (mini)conda to install a more recent version of Python in his/her home directory, but I

Debugging reason for python running unreasonably slow when adding numbers

2023-03-14 Thread Alexander Nestorov
I'm working on an NLP and I got bitten by an unreasonably slow behaviour in Python while operating with small amounts of numbers. I have the following code: ```python import random, time from functools import reduce def trainPerceptron(perceptron, data):   learningRate = 0.002   weights = perce

Re: Running asyncio.run() more than once

2023-03-14 Thread gst
Le mardi 14 mars 2023 à 02:32:23 UTC-4, Clint Olsen a écrit : > We have an application that involves submitting hundreds to thousands of jobs > to a shared computing resource, and we're using asyncio to do so because it > is far less overhead than threading or multiprocessing for the bookkeeping

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 positi

Re: Tkinter and cv2: "not responding" popup when imshow launched from tk app

2023-03-14 Thread Weatherby,Gerard
Assuming you’re using opencv-python, I’d post query at https://github.com/opencv/opencv-python/issues. From: Python-list on behalf of John O'Hagan Date: Tuesday, March 14, 2023 at 6:56 AM To: Python list Subject: Tkinter and cv2: "not responding" popup when imshow launched from tk app *** At

Re: Tkinter and cv2: "not responding" popup when imshow launched from tk app

2023-03-14 Thread Thomas Passin
On 3/14/2023 6:54 AM, John O'Hagan wrote: Hi list I'm trying to use cv2 to display images created as numpy arrays, from within a tkinter app (which does other things with the arrays before they are displayed as images). The arrays are colour-coded visualisations of genomes and can be over a bill

Tkinter and cv2: "not responding" popup when imshow launched from tk app

2023-03-14 Thread John O'Hagan
Hi list I'm trying to use cv2 to display images created as numpy arrays, from within a tkinter app (which does other things with the arrays before they are displayed as images). The arrays are colour-coded visualisations of genomes and can be over a billion elements in size, and I've found the PIL