Python and the need for speed
rosuav at gmail.com
Wed Apr 12 01:01:20 EDT 2017
On Wed, Apr 12, 2017 at 2:32 PM, Paul Rubin <no.email at nospam.invalid> wrote:
> Chris Angelico <rosuav at gmail.com> writes:
>> Python, meanwhile, has made it easy to write blocking
>> I/O in a single-threaded program, and then adds async'ness to it.
> I'd be interested to know how to open a disk file asynchronously in a
> single-threaded Python program under Linux. As far as I can tell there
> is no way to do it.
historically been aimed at web browsers, where you're not allowed to
open files as such, but you _can_ make HTTP requests. It's also
entirely possible to have a single "application thread" and then a
"file opening thread" that does nothing but open files; your app is
still single threaded (thus you don't have concurrency concerns), but
file opening becomes truly asynchronous.
Oh, and Python also has to cope with a bit more complexity because
it's possible to start multiple application threads in Python. It's
not in JS.
More information about the Python-list