Re: Pythonic style

2020-09-21 Thread Léo El Amri via Python-list
On 21/09/2020 15:15, Tim Chase wrote: > You can use tuple unpacking assignment and Python will take care of > the rest for you: > > so you can do > > def fn(iterable): > x, = iterable > return x > > I'm not sure it qualifies as Pythonic, but it uses Pythonic features > like tuple

Re: Pythonic style

2020-09-21 Thread Léo El Amri via Python-list
On 21/09/2020 00:34, Stavros Macrakis wrote: > I'm trying to improve my Python style. > > Consider a simple function which returns the first element of an iterable > if it has exactly one element, and throws an exception otherwise. It should > work even if the iterable doesn't terminate. I've

Re: Asyncio Queue implementation suggestion

2020-09-17 Thread Léo El Amri via Python-list
On 17/09/2020 16:51, Dennis Lee Bieber wrote: > On Wed, 16 Sep 2020 13:39:51 -0400, Alberto Sentieri <2...@tripolho.com> > declaimed the following: > >> devices tested simultaneously, I soon run out of file descriptor. Well, >> I increased the number of file descriptor in the application and

Re: Asyncio Queue implementation suggestion

2020-09-17 Thread Léo El Amri via Python-list
Hello Alberto, I scrambled your original message a bit here. > Apparently asyncio Queues use a Linux pipe and each queue require 2 file > descriptors. Am I correct? As far as I know (And I know a bit about asyncio in CPython 3.5+) asyncio.queues.Queue doesn't use any file descriptor. It is

Re: There is LTS?

2020-08-24 Thread Léo El Amri via Python-list
On 24/08/2020 04:54, 황병희 wrote: > Hi, just i am curious. There is LTS for *Python*? If so, i am very thank > you for Python Project. Hi Byung-Hee, Does the "LTS" acronym you are using here stands for "Long Term Support" ? If so, then the short answer is: Yes, kind of. There is a 5 years

Re: Asyncio tasks getting cancelled

2018-11-05 Thread Léo El Amri via Python-list
On 05/11/2018 16:38, i...@koeln.ccc.de wrote: > I just saw, actually > using the same loop gets rid of the behavior in this case and now I'm > not sure about my assertions any more. It's fixing the issue because you're running loop with the run_forever(). As Ian and myself pointed out, using both

Re: Asyncio tasks getting cancelled

2018-11-05 Thread Léo El Amri via Python-list
On 05/11/2018 07:55, Ian Kelly wrote: >> I assume it's kind of a run_forever() with some code before it >> to schedule the coroutine. > > My understanding of asyncio.run() from > https://github.com/python/asyncio/pull/465 is that asyncio.run() is > more or less the equivalent of

Re: Asyncio tasks getting cancelled

2018-11-04 Thread Léo El Amri via Python-list
On 04/11/2018 20:25, i...@koeln.ccc.de wrote: > I'm having trouble with asyncio. Apparently tasks (asyncio.create_task) > are not kept referenced by asyncio itself, causing the task to be > cancelled when the creating function finishes (and noone is awaiting the > corresponding futue). Am I doing

Re: Package creation documentation?

2018-10-16 Thread Léo El Amri via Python-list
Hello Spencer, On 16/10/2018 17:15, Spencer Graves wrote: > Where can I find a reasonable tutorial on how to create a Python > package? IMO, the best documentation about this is the tutorial: https://docs.python.org/3/tutorial/modules.html#packages > According to the Python 3

Re: Package creation documentation?

2018-10-16 Thread Léo El Amri via Python-list
Given your coding experience also you may want to look at https://docs.python.org/3/reference/import.html#packages, which is the technical detail of what a package is (And "how" it's implemented). -- https://mail.python.org/mailman/listinfo/python-list

Re: asyncio await different coroutines on the same socket?

2018-10-03 Thread Léo El Amri via Python-list
Hello Russell, On 03/10/2018 15:44, Russell Owen wrote: > Using asyncio I am looking for a simple way to await multiple events where > notification comes over the same socket (or other serial stream) in arbitrary > order. For example, suppose I am communicating with a remote device that can >

Re: [OT] master/slave debate in Python

2018-09-26 Thread Léo El Amri via Python-list
On 26/09/2018 06:34, Ian Kelly wrote: > Chris Angelico wrote: >> What I know about them is that they (and I am assuming there are >> multiple people, because there are reports of multiple reports, if >> that makes sense) are agitating for changes to documentation without >> any real backing. > >

Re: [OT] master/slave debate in Python

2018-09-24 Thread Léo El Amri via Python-list
On 24/09/2018 18:30, Dan Purgert wrote: > Robin Becker wrote: >> [...] just thought control of the wrong sort.. > > Is there "thought control of the right sort"? We may have to ask to Huxley -- https://mail.python.org/mailman/listinfo/python-list

Re: [OT] master/slave debate in Python

2018-09-24 Thread Léo El Amri via Python-list
On 24/09/2018 14:52, Robin Becker wrote: > On 23/09/2018 15:45, Albert-Jan Roskam wrote: >> *sigh*. I'm with Hettinger on this. >> >> https://www.theregister.co.uk/2018/09/11/python_purges_master_and_slave_in_political_pogrom/ >> >> > I am as well. Don't fix what is not broken. The semantics (in >

>< swap operator

2018-08-13 Thread Léo El Amri via Python-list
On 13/08/2018 21:54, skybuck2...@hotmail.com wrote: > I just had a funny idea how to implement a swap operator for types: > > A >< B > > would mean swap A and B. I think that: a, b = b, a is pretty enough -- https://mail.python.org/mailman/listinfo/python-list

Python 3.6 Logging time is not listed

2018-08-13 Thread Léo El Amri via Python-list
On 13/08/2018 19:23, MRAB wrote: > Here you're configuring the logger, setting the name of the logfile and > the logging level, but not specifying the format, so it uses the default > format: > >> logging.basicConfig(filename='example.log',level=logging.DEBUG) > > Here you're configuring the

Re: asyncio: Warning message when waiting for an Event set by AbstractLoop.add_reader

2018-08-12 Thread Léo El Amri via Python-list
I found out what was the problem. The behavior of my "reader" (The callback passed to AbstractEventLoop.add_reader()) is to set an event. This event is awaited for in a coroutine which actually reads what is written on a pipe. The execution flow is the following: * NEW LOOP TURN * The selector

Re: Embedded Python and multiprocessing on Windows?

2018-08-10 Thread Léo El Amri via Python-list
On 09/08/2018 19:33, Apple wrote:> So my program runs one script file, and multiprocessing commands from that script file seem to fail to spawn new processes. > > However, if that script file calls a function in a separate script file that > it has imported, and that function calls

Re: asyncio: Warning message when waiting for an Event set by AbstractLoop.add_reader

2018-08-03 Thread Léo El Amri via Python-list
how all the thing is behaving in the shadows. Maybe I'm simply doing something wrong. But it would mean that the documentation is lacking some details, or maybe that I'm just really stupid on this one. On 03/08/2018 07:05, dieter wrote: > Léo El Amri via Python-list wri

asyncio: Warning message when waiting for an Event set by AbstractLoop.add_reader

2018-08-02 Thread Léo El Amri via Python-list
Hello list, During my attempt to bring asyncio support to the multiprocessing Queue, I found warning messages when executing my code with asyncio debug logging enabled. It seems that awaiting for an Event will make theses messages appears after the second attempt to wait for the Event. Here is

Why is multiprocessing.Queue creating a thread ?

2018-07-29 Thread Léo El Amri via Python-list
Hello list, This is a simple question: I wonder what is the reason behind multiprocessing.Queue creating a thread to send objects through a multiprocessing.connection.Connection. I plan to implement an asyncio "aware" Connection class. And while reading the source code of the multiprocessing