Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Chris Angelico Newsgroups: comp.lang.python Subject: Re: asyncio - run coroutine in the background Date: Sat, 20 Feb 2016 20:02:18 +1100 Lines: 20 Message-ID: References: <8737sumpjl.fsf@elektro.pacujo.net> <87h9ha8lt0.fsf@jester.gateway.pace.com> <87d1rwpwo2.fsf@elektro.pacujo.net> <87r3gc608i.fsf@elektro.pacujo.net> <871t877ru6.fsf@jester.gateway.pace.com> <87oabbpzoo.fsf@elektro.pacujo.net> <87twl36amj.fsf@jester.gateway.pace.com> <87io1jpxjw.fsf@elektro.pacujo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de H16zaax/osHEA9V7JP5/VQOj8tZIx421XdGpklM8eHIQ== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'received:209.85.223': 0.03; 'skip:/ 10': 0.07; 'cc:addr:python-list': 0.09; 'caching,': 0.09; 'lookup': 0.09; 'python': 0.10; 'itself.': 0.11; 'server,': 0.15; '2016': 0.16; 'caches': 0.16; 'caching': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'hacked': 0.16; 'ignores': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:run': 0.16; 'sure.': 0.16; 'wrote:': 0.16; 'library': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'feb': 0.23; 'sat,': 0.23; 'written': 0.24; 'header:In-Reply-To:1': 0.24; '(which': 0.26; 'chris': 0.26; 'message-id:@mail.gmail.com': 0.27; 'entries': 0.27; 'regular': 0.29; 'server.': 0.30; "can't": 0.32; 'server': 0.34; 'gives': 0.35; 'received:google.com': 0.35; 'on,': 0.35; 'generic': 0.35; 'mine': 0.35; 'but': 0.36; 'instead': 0.36; 'received:209.85': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'received:209': 0.38; 'goes': 0.39; 'subject:the': 0.39; 'where': 0.40; 'notified': 0.62; 'capable': 0.65; '20,': 0.66; 'situation': 0.67; 'chrisa': 0.84; 'depended': 0.84; 'to:none': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=DJubSiGorB13shn1TqX5NR+wg1YW14iRQdRKIPQC6Do=; b=Jkz/dxPicI4UUd18MrERQ/9E07CvOsque/1DDEAClsRwpHdsISwAcp2GbxRS2ttb3X U5Yz/VRqpdyBTX5VqUvpCStebgZ31fDFLrOi4g8oZa7wrMJ/+61FqvT1Onth5dxCIA+v mGmUd+rA5VsOKq/+NzvAN7EWzmupQXwUzdjnIG/27SEEnf4iRPBgo0kUpgUu1/krXKHv AVPOxSdWmu66FtuyG9LGkqy2JdFllgxqZySr0iS+K8K/zgH+CKPa33fL9vSv8IFMxnIl fIUVlG0VSQeHYfqdDb2nELQwl8MfMGzQlkfwX+XCP18YH3rBNdCGrls+alQqNmgOslhP +j8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:cc:content-type; bh=DJubSiGorB13shn1TqX5NR+wg1YW14iRQdRKIPQC6Do=; b=jcpOFWf8wVjhZ9PnziGObkS+Klk2oi+TSJOHBlnH6Si4zD1CvohxTKj0LxLNM4gXl+ 72Dlp1oYwNMZ4SmlxX/2H6E5rAug8HkYXdsbvuSInfNZM3Vp17m+bHFQCXsFgYyC6Btx OBQ+uThlaC1EQY3vmEvSowTrF73tPAdEC5SSp2IWIwA50cOLiHikD62XVx0lFKII5moW m30Eiu5S36EZzEwwkew7eaDy7+jUcaluvaUHb64q4wUWnmhJByj587TDEMqko1pPcGGq AJSiAKfTtsN9OY2Q3/YbfeDBP44Lopwkx2nQWNY+X8W0T4fuoZb86nt1bKy6aTQjOLcT RNpQ== X-Gm-Message-State: AG10YOSs6PuAc98Txb0meNw2wOuYt9nFW7G9YrUnUfTOPU/j3lTXS6v+jLo/ZiYRWqZpL1q4HP+OksDy0vLMxg== X-Received: by 10.107.47.162 with SMTP id v34mr17197227iov.19.1455958939118; Sat, 20 Feb 2016 01:02:19 -0800 (PST) In-Reply-To: <87io1jpxjw.fsf@elektro.pacujo.net> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21rc2 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:103258 On Sat, Feb 20, 2016 at 7:59 PM, Marko Rauhamaa wrote: > Chris Angelico : > >> In a (non-Python) program of mine, I got annoyed by synchronous name >> lookups, so I hacked around it: instead of using the regular library >> functions, I just do a DNS lookup directly (which can then be >> event-based - send a UDP packet, get notified when a UDP packet >> arrives). Downside: Ignores /etc/nsswitch.conf and /etc/hosts, and >> goes straight to the name server. Upside: Is able to do its own >> caching, since the DNS library gives me the TTLs, but >> gethostbyname/getaddrinfo won't. > > Ditto in a Python program of mine, although I don't bother with caching: > the DNS server is perfectly capable of caching the entries for me. If you know you have a local DNS server, sure. Mine is written for a generic situation where that can't be depended on, so it caches itself. But it's no big deal. ChrisA