Re: Using a background thread with asyncio/futures with flask

2024-03-24 Thread Frank Millman via Python-list

On 2024-03-23 3:25 PM, Frank Millman via Python-list wrote:



It is not pretty! call_soon_threadsafe() is a loop function, but the 
loop is not accessible from a different thread. Therefore I include a 
reference to the loop in the message passed to in_queue, which in turn 
passes it to out_queue.




I found that you can retrieve the loop from the future using 
future.get_loop(), so the above is not necessary.


Frank


--
https://mail.python.org/mailman/listinfo/python-list


Re: the name ``wheel''

2024-03-24 Thread Barry via Python-list


> On 22 Mar 2024, at 20:28, Mats Wichmann via Python-list 
>  wrote:
> 
> pip is still a separate package in the .rpm world. which makes sense on a 
> couple of levels:

Yes it’s a separate package, but it’s always installed. At least on Fedora.
I agree it makes sense to package it separately, which is inline with Fedora’s
policy of not vendoring code into a package.

Barry


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Popping key causes dict derived from object to revert to object

2024-03-24 Thread Loris Bennett via Python-list
 writes:

> Loris wrote:
>
> "Yes, I was mistakenly thinking that the popping the element would leave
> me with the dict minus the popped key-value pair.  Seem like there is no
> such function."
>
> Others have tried to explain and pointed out you can del and then use the
> changed dict.
>
> But consider the odd concept of writing your own trivial function.
>
> def remaining(adict, anitem):
>   _ = adict.pop(anitem)
>   # alternatively duse del on dict and item
>   return adict
>
>
 remaining({"first": 1, "second": 2, "third": 3}, "second")
> {'first': 1, 'third': 3}
>
>
> Or do you want to be able to call it as in dict.remaining(key) by
> subclassing your own variant of dict and adding a similar method?

No, 'del' does indeed do what I wanted, although I have now decided I
want something else :-)  Nevertheless it is good to know that 'del'
exists, so that I don't have to reinvent it.

Cheers,

Loris

-- 
This signature is currently under constuction.
-- 
https://mail.python.org/mailman/listinfo/python-list