Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'essentially': 0.04; 'explicitly': 0.04; 'handler': 0.04; 'subject:Python': 0.05; 'nested': 0.07; 'raised': 0.07; 'run,': 0.07; 'twisted,': 0.07; 'used.': 0.07; 'api': 0.09; 'python': 0.09; 'ast': 0.09; 'closest': 0.09; 'created,': 0.09; 'pep': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'sep': 0.09; 'sockets': 0.09; 'thread': 0.11; '(where': 0.15; 'stack': 0.15; '380': 0.16; '[5]': 0.16; 'badly.': 0.16; 'decent': 0.16; 'emulation': 0.16; 'event-driven': 0.16; 'framework,': 0.16; 'otoh,': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'refactored': 0.16; 'space;': 0.16; 'subroutine': 0.16; 'threading,': 0.16; 'trampoline': 0.16; 'twisted': 0.16; "where's": 0.16; 'accepting': 0.18; 'memory': 0.18; 'windows': 0.19; 'load': 0.19; 'appropriate': 0.20; 'sort': 0.21; 'regardless': 0.21; '(by': 0.22; 'runs': 0.22; "i'd": 0.22; 'branch': 0.23; 'matching': 0.23; "i've": 0.23; 'tried': 0.25; 'wrote': 0.26; 'ago': 0.27; 'implemented': 0.27; 'used,': 0.27; '(e.g.,': 0.27; 'execution': 0.27; 'library.': 0.27; "doesn't": 0.28; 'header:X-Complaints- To:1': 0.28; 'initial': 0.28; 'run': 0.28; 'changes:': 0.29; 'coded': 0.29; 'hacker': 0.29; 'i/o': 0.29; 'periodic': 0.29; 'socket,': 0.29; "i'm": 0.29; 'maybe': 0.29; 'connections': 0.30; 'framework': 0.30; 'initially': 0.30; 'mode': 0.30; 'function': 0.30; 'sense': 0.31; 'code': 0.31; 'point': 0.31; 'file': 0.32; 'channel': 0.32; 'could': 0.32; 'instead,': 0.33; 'url:home': 0.33; 'to:addr:python-list': 0.33; 'consistent': 0.35; 'massive': 0.35; 'received:org': 0.36; 'but': 0.36; "didn't": 0.36; 'anything': 0.36; "i'll": 0.36; 'charset:us-ascii': 0.36; 'two': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'where': 0.40; 'header:Received:5': 0.40; 'your': 0.60; 'between': 0.63; 'different': 0.63; 'world': 0.63; 'skip:n 10': 0.63; 'hear': 0.63; 'making': 0.64; 'forward': 0.66; 'account': 0.67; 'incoming': 0.69; 'capabilities': 0.71; 'transfer': 0.76; 'atop': 0.84; 'interrupt': 0.84; 'issues:': 0.84; 'suspended,': 0.84; 'suspension': 0.84; 'dennis': 0.91; 'suspended': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dennis Lee Bieber Subject: Re: Standard Asynchronous Python Date: Mon, 10 Sep 2012 01:44:44 -0400 Organization: > Bestiaria Support Staff < References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: adsl-76-249-29-63.dsl.klmzmi.sbcglobal.net X-Newsreader: Forte Agent 3.3/32.846 X-No-Archive: YES X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 57 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1347255896 news.xs4all.nl 6913 [2001:888:2000:d::a6]:40082 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:28802 On Sun, 9 Sep 2012 20:07:51 -0400, "Dustin J. Mitchell" declaimed the following in gmane.comp.python.general: > > My proposal met with near-silence, and I didn't pursue it. Instead, I > did what any self-respecting hacker would do - I wrote up a framework, > uthreads [4], that implemented my idea. This was initially a simple > trampoline scheduler, but I eventually refactored it to run atop > Twisted, since that's what I use. To my knowledge, it's never been > used. > So for your small attempt to hide an event-driven dispatcher, one has to load a massive event-driven library. Some years ago I tried to make sense of Twisted and failed badly. Maybe it makes sense to those raised on UNIX style select() (where practically anything that involved data transfer over some sort of channel could be tested -- but doesn't work as such on Windows where only network sockets can be used, file i/o needs to use a different call), but my background is on devices with event flag clusters (VMS, and in a way, even AmigaOS -- both of which had decent IPC capabilities [mailboxes and message ports, respectively]). Closest to event-driven I've coded was using VMS Asynchronous System[or Service] Traps -- essentially user mode interrupt handlers, which the OS would dispatch when the I/O event completed; no need to do a periodic select() and branch -- the main thread would be suspended, the specific AST handler would run, and execution would return to the point of suspension (I use the term "suspension" but it is NOT the same as suspended thread/process -- no new stack is created, the AST runs on the suspended code's stack space; it is like a subroutine call was jammed in between two instructions) Threading, OTOH, has always made sense to me. > I'm considering re-drafting the PEP with the following changes: > > * De-emphasize the thread emulation aspects, and focus on > code-portability issues: > * callbacks vs. "blocking" calls (e.g., when accepting incoming > connections on a socket, how is my code invoked?) > * consistent access to primitives, regardless of framework (e.g., > where's the function I call to branch execution?) > * nested asynchronous methods > * Account for PEP 380 (by making the StopIteration workarounds match > PEP 380, and explicitly deprecating them after Python 3.3) > * Look forward to a world with software transactional memory [5] by > matching that API where appropriate > > As I get to work on the PEP, I'd like to hear any initial reactions to the idea. > If I want Modula-2 co-routines, I'll use Modula-2 ... Or maybe Ada tasks with rendezvous... -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/