Re: for -- else: what was the motivation?

2022-10-07 Thread Dan Stromberg
The else is executed if you don't "break" out of the loop early. It cuts down on boolean flags. On Fri, Oct 7, 2022 at 8:40 PM Axy via Python-list wrote: > Hi there, > > this is rather a philosophical question, but I assume I miss something. > I don't remember I ever used else clause for years

for -- else: what was the motivation?

2022-10-07 Thread Axy via Python-list
Hi there, this is rather a philosophical question, but I assume I miss something. I don't remember I ever used else clause for years I was with python and my expectation was it executed only if the the main body was never run. Ha-ha! I was caught by this mental trap. So, seriously, why they

Re: Will "hello" always be printed?

2022-10-07 Thread MRAB
On 2022-10-08 00:40, Cameron Simpson wrote: On 07Oct2022 20:16, Robin van der veer wrote: If I have two processes communicating through a JoinableQueue, and I do the following: process 1: queue.put(1) #unfished tasks = 1 queue.join() #block until unfished tasks = 0 print('hello')[/py

Re: Will "hello" always be printed?

2022-10-07 Thread Cameron Simpson
On 07Oct2022 20:16, Robin van der veer wrote: If I have two processes communicating through a JoinableQueue, and I do the following: process 1: queue.put(1) #unfished tasks = 1 queue.join() #block until unfished tasks = 0 print('hello')[/python] process 2: queue.get() queue.ta

Re: Debugging automatic quotation in subprocess.Popen()

2022-10-07 Thread Eryk Sun
On 10/7/22, c.bu...@posteo.jp wrote: > > I need to improve my understanding about how subprocess.Popen() does > quote arguments. I have special case here. > > Simple example: > Popen(['ls', '-l']) results on a shell in "ls -l" without quotation. The shell is only used if Popen is instantiated wit

Re: Debugging automatic quotation in subprocess.Popen()

2022-10-07 Thread Chris Angelico
On Sat, 8 Oct 2022 at 08:24, wrote: > > Hello, > > I need to improve my understanding about how subprocess.Popen() does > quote arguments. I have special case here. > > Simple example: > Popen(['ls', '-l']) results on a shell in "ls -l" without quotation. > > Quotes are added if they are needed: >

Re: Ref-strings in logging messages (was: Performance issue with CPython 3.10 + Cython)

2022-10-07 Thread Julian Smith
On Fri, 7 Oct 2022 18:28:06 +0100 Barry wrote: > > On 7 Oct 2022, at 18:16, MRAB wrote: > > > > On 2022-10-07 16:45, Skip Montanaro wrote: > >>> On Fri, Oct 7, 2022 at 9:42 AM Andreas Ames > >>> > >>> wrote: > >>> 1. The culprit was me. As lazy as I am, I have used f-strings all over the >

Will "hello" always be printed?

2022-10-07 Thread Robin van der veer
If I have two processes communicating through a JoinableQueue, and I do the following: process 1: queue.put(1) #unfished tasks = 1 queue.join() #block until unfished tasks = 0 print('hello')[/python] process 2: queue.get() queue.task_done() #unfished tasks = 0 queue.put(

Debugging automatic quotation in subprocess.Popen()

2022-10-07 Thread c.buhtz
Hello, I need to improve my understanding about how subprocess.Popen() does quote arguments. I have special case here. Simple example: Popen(['ls', '-l']) results on a shell in "ls -l" without quotation. Quotes are added if they are needed: Popen(['ls', 'folder with blank']) results on a shell i

Re: Gdal

2022-10-07 Thread Loris Bennett
Hi Conrado, "\"Jorge Conrado Conforte\"" writes: > Hi, > > > > > I installed GDAL using the pip command and conda. But, I did: > > import gdal and I had: Depending on your GDAL version, you might find you have to do from osgeo import gdal See https://gdal.org/api/python_bindings.html#

Re: Ref-strings in logging messages (was: Performance issue with CPython 3.10 + Cython)

2022-10-07 Thread Barry
> On 7 Oct 2022, at 19:09, Weatherby,Gerard wrote: > The obvious way to avoid log generation is: > > if logger.isEnableFor(logging.DEBUG): >logger.debug( expensive processing ) > > > Of course, having logging alter program flow could lead to hard to debug bugs. Altered flow i

Re: Ref-strings in logging messages (was: Performance issue with CPython 3.10 + Cython)

2022-10-07 Thread Weatherby,Gerard
The obvious way to avoid log generation is: if logger.isEnableFor(logging.DEBUG): logger.debug( expensive processing ) Of course, having logging alter program flow could lead to hard to debug bugs. From: Python-list on behalf of Barry Date: Friday, October 7, 2022 at 1:30 PM

Re: Ref-strings in logging messages (was: Performance issue with CPython 3.10 + Cython)

2022-10-07 Thread Barry
> On 7 Oct 2022, at 18:16, MRAB wrote: > > On 2022-10-07 16:45, Skip Montanaro wrote: >>> On Fri, Oct 7, 2022 at 9:42 AM Andreas Ames >>> wrote: >>> 1. The culprit was me. As lazy as I am, I have used f-strings all over the >>> place in calls to `logging.logger.debug()` and friends, evaluatin

Re: Ref-strings in logging messages (was: Performance issue with CPython 3.10 + Cython)

2022-10-07 Thread MRAB
On 2022-10-07 16:45, Skip Montanaro wrote: On Fri, Oct 7, 2022 at 9:42 AM Andreas Ames wrote: 1. The culprit was me. As lazy as I am, I have used f-strings all over the place in calls to `logging.logger.debug()` and friends, evaluating all arguments regardless of whether the logger was enabled

Re: Ref-strings in logging messages (was: Performance issue with CPython 3.10 + Cython)

2022-10-07 Thread Barry
> On 7 Oct 2022, at 16:48, Skip Montanaro wrote: > > On Fri, Oct 7, 2022 at 9:42 AM Andreas Ames > wrote: > >> 1. The culprit was me. As lazy as I am, I have used f-strings all over the >> place in calls to `logging.logger.debug()` and friends, evaluating all >> arguments regardless of wheth

Re: Ref-strings in logging messages (was: Performance issue with CPython 3.10 + Cython)

2022-10-07 Thread Skip Montanaro
Dang autocorrect. Subject first word was supposed to be "f-strings" not "ref-strings." Sorry about that. S On Fri, Oct 7, 2022, 10:45 AM Skip Montanaro wrote: > > > On Fri, Oct 7, 2022 at 9:42 AM Andreas Ames > wrote: > >> 1. The culprit was me. As lazy as I am, I have used f-strings all over

Ref-strings in logging messages (was: Performance issue with CPython 3.10 + Cython)

2022-10-07 Thread Skip Montanaro
On Fri, Oct 7, 2022 at 9:42 AM Andreas Ames wrote: > 1. The culprit was me. As lazy as I am, I have used f-strings all over the > place in calls to `logging.logger.debug()` and friends, evaluating all > arguments regardless of whether the logger was enabled or not. > I thought there was some dis

Re: Performance issue with CPython 3.10 + Cython

2022-10-07 Thread Andreas Ames
Answering to myself, just for the records: 1. The culprit was me. As lazy as I am, I have used f-strings all over the place in calls to `logging.logger.debug()` and friends, evaluating all arguments regardless of whether the logger was enabled or not. Replacing these f-strings by regular printf-l

Re: Gdal

2022-10-07 Thread Dioumacor FAYE
If you are working on ubuntu, you can use this command. conda create --name pygdal conda activate pygdal conda install -c conda-forge gdal If installation completes import it from: from osgeo import gdal Le ven. 7 oct. 2022 à 12:01, "Jorge Conrado Conforte" < jorge.confo...@inpe.br> a écrit : > >

Gdal

2022-10-07 Thread "Jorge Conrado Conforte"
Hi, I installed GDAL using the pip command and conda. But, I did: import gdal and I had: Traceback (most recent call last): File "", line 1, in ModuleNotFoundError: No module named 'gdal' I need gdal to remap some data. Please, help me Conrado -- https://mail.python.or

How to create forecast lead time with python?

2022-10-07 Thread Dioumacor FAYE
Hello, I wanted to create on different days the deadline forecast files (2, 3, 4, and 5 deadlines). The file is in NetCDF format. The objective is to see later on these different forecast deadlines which one gives the best score. If anyone can help me to do? -- Bien à vous, -