Re: Await expressions (Posting On Python-List Prohibited)

2024-02-03 Thread Mild Shock via Python-list



Funny source code tells me IOCP is used;

proactor is only implemented on Windows with IOCP.
https://github.com/python/cpython/blob/3.12/Lib/asyncio/proactor_events.py

But maybe the focus is more on networking than file system.

But it has sock_sendfile() that might avoid copying data to userspace.

Mild Shock schrieb:

The docu tells me:

Windows
loop.add_reader() and loop.add_writer() only accept
socket handles (e.g. pipe file descriptors are not supported).
https://docs.python.org/3/library/asyncio-platforms.html

Alternatives are aiofiles and anyio and maybe more,
but not sure whether they span all platforms, i.e. unix,
windows and mac or whether they have similar restrictions.

Theoretically on Windows IOCP should also cover file handles:
https://en.wikipedia.org/wiki/Input/output_completion_port

Its use by libuv the basis for node.js.

Lawrence D'Oliveiro schrieb:

On Sat, 3 Feb 2024 00:45:18 +0100, Mild Shock wrote:


... that works on windows ...


You lost me there.





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


Re: Await expressions (Posting On Python-List Prohibited)

2024-02-03 Thread Mild Shock via Python-list

The docu tells me:

Windows
loop.add_reader() and loop.add_writer() only accept
socket handles (e.g. pipe file descriptors are not supported).
https://docs.python.org/3/library/asyncio-platforms.html

Alternatives are aiofiles and anyio and maybe more,
but not sure whether they span all platforms, i.e. unix,
windows and mac or whether they have similar restrictions.

Theoretically on Windows IOCP should also cover file handles:
https://en.wikipedia.org/wiki/Input/output_completion_port

Its use by libuv the basis for node.js.

Lawrence D'Oliveiro schrieb:

On Sat, 3 Feb 2024 00:45:18 +0100, Mild Shock wrote:


... that works on windows ...


You lost me there.



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


Re: Await expressions (Posting On Python-List Prohibited)

2024-02-03 Thread Mild Shock via Python-list


And whats the roadmap for an asyncified module
loader, is this on the radar of Python?

Mild Shock schrieb:


I am still waiting for async files in the
style of nodejs that works on windows and

is bundled with the main python distribution.
I am not very  fond on doing something

like adding listeners to a file descriptor,
in nodejs async files are based on callbacks

not on listeners. Whats the roadmap here?

Lawrence D'Oliveiro schrieb:

On 2 Feb 2024 09:12:06 GMT, Stefan Ram wrote:


|The IO part of the event loop is built upon a single crucial
|function called "select".


select(2) has limitations. Better to use poll(2). Depending on *nix
variant, other more advanced alternatives may also be available
.





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


Re: Await expressions (Posting On Python-List Prohibited)

2024-02-03 Thread Mild Shock via Python-list



I am still waiting for async files in the
style of nodejs that works on windows and

is bundled with the main python distribution.
I am not very  fond on doing something

like adding listeners to a file descriptor,
in nodejs async files are based on callbacks

not on listeners. Whats the roadmap here?

Lawrence D'Oliveiro schrieb:

On 2 Feb 2024 09:12:06 GMT, Stefan Ram wrote:


|The IO part of the event loop is built upon a single crucial
|function called "select".


select(2) has limitations. Better to use poll(2). Depending on *nix
variant, other more advanced alternatives may also be available
.



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


Re: Await expressions (Posting On Python-List Prohibited)

2024-02-02 Thread Jon Ribbens via Python-list
On 2024-02-02, Lawrence D'Oliveiro  wrote:
> On 1 Feb 2024 10:09:10 GMT, Stefan Ram wrote:
>
>>   Heck, even of the respected members of this newsgroup, IIRC, no one
>>   mentioned "__await__".
>
> It’s part of the definition of an “awaitable”, if you had looked that up.
>
>

To be fair, I've been using Python for well over quarter of a century,
and I never knew it had a glossary.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Await expressions (Posting On Python-List Prohibited)

2024-01-27 Thread Dieter Maurer via Python-list
>On 27/01/24 10:46 am, Stefan Ram wrote:
>>But your explanation seems to have no mention of the "something" /
>>"the awaitable object" part following the preposition "on". Shouldn't
>>this awaitable object play a rôle in the explanation of what happens?

You can explain a function call without saying much about the called function.
Similarly, you can explain "await " without saying much about
"".

Important is only: "" evaluates to an "awaitable".
An "awaitable" (usually an `asyncio.Future`, `asyncio.Task` or
call of an `async` function) eventuelly produces
a value and `await ` waits until
this happens and then returns this value.

Not everything which eventually returns a value is an
"awaitable" -- e.g. a call of `time.sleep` is not an "awaitable".
Special provisions are necessary to be able to wait for a value
(and meanwhile do other things).
`asyncio.sleep` has e.g. this provisions and a call of it is an "awaitable".

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


Re: Await expressions (Posting On Python-List Prohibited)

2024-01-26 Thread Chris Angelico via Python-list
On Sat, 27 Jan 2024 at 11:01, Greg Ewing via Python-list
 wrote:
>
> If it helps at all, you can think of an async function as being
> very similar to a generator, and "await" as being very similar to
> "yield from". In the current implementation they're almost exactly
> the same thing underneath.
>

Don't bother responding to people who say that they don't want
responses on a public list.

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


Re: Await expressions (Posting On Python-List Prohibited)

2024-01-26 Thread Greg Ewing via Python-list

On 27/01/24 10:46 am, Stefan Ram wrote:

   But your explanation seems to have no mention of the "something" /
   "the awaitable object" part following the preposition "on". Shouldn't
   this awaitable object play a rôle in the explanation of what happens?


If it helps at all, you can think of an async function as being
very similar to a generator, and "await" as being very similar to
"yield from". In the current implementation they're almost exactly
the same thing underneath.

--
Greg

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