Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder3.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'socket': 0.05; 'function,': 0.07; 'suppose': 0.07; 'subject:question': 0.08; 'dict': 0.09; 'sockets': 0.09; "system's": 0.09; 'yeah,': 0.09; "wouldn't": 0.11; 'skip:f 30': 0.15; 'afterwards.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'sock': 0.16; 'wrote:': 0.17; 'instance,': 0.17; 'thanks,': 0.18; 'feb': 0.19; 'paul': 0.24; 'header:In-Reply-To:1': 0.25; 'select': 0.26; 'am,': 0.27; 'operations,': 0.27; 'message- id:@mail.gmail.com': 0.27; 'rest': 0.28; 'chris': 0.28; 'writes:': 0.29; 'probably': 0.29; 'maybe': 0.29; 'that.': 0.30; 'connections': 0.30; 'fri,': 0.30; 'builds': 0.33; 'to:addr :python-list': 0.33; 'received:google.com': 0.34; 'list': 0.35; 'received:209.85': 0.35; 'anything': 0.36; "i'll": 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'object': 0.38; 'to:addr:python.org': 0.39; 'application': 0.40; 'your': 0.60; 'you.': 0.61; 'back': 0.62; 'broadcast': 0.65; 'harder': 0.65; 'news': 0.68; 'hoping': 0.72; '2013': 0.84; 'manages': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=a6OhrfZ5FsEp7uc+cQuAUnHTZ6iGYTRIrJ1b7KAwvFE=; b=Zxk+2z5AEHuR9IeXpfY2xMGk/T4n90LLulbxkYfLPx4xBzmGiLtCvoOziRWFlo6vcc 6gfhXdJ0HXer+kHAC40lcZLfou05fIJtAEMtGOQVK2EqMIZU5U577XztN6/OVRmWY0kw WtWzmxvp3xXi6cNE7aoUEg7XesuJ+0Kea/KlfI0xs2y7qk/HolS/VInuMvUQAHDczpRt 0aftR8to6WA50U0K1UEVvJdun3WX8n/drebDrWh1lioajgNCNTz59HpzFeIrxWiT2EF+ /ZlbLvHSJ6JU5TOBwOqRbFpfRZHgjdtPvKe7johFWC1AOEd3urGRin9XsV/CCKopBI5t ErxA== MIME-Version: 1.0 X-Received: by 10.58.12.200 with SMTP id a8mr2372198vec.52.1360254270377; Thu, 07 Feb 2013 08:24:30 -0800 (PST) In-Reply-To: <7x1ucs2j8m.fsf@ruckus.brouhaha.com> References: <7xbobw1tzr.fsf@ruckus.brouhaha.com> <7x1ucs2j8m.fsf@ruckus.brouhaha.com> Date: Fri, 8 Feb 2013 03:24:30 +1100 Subject: Re: select.epoll question From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 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: 19 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1360254273 news.xs4all.nl 6944 [2001:888:2000:d::a6]:53342 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:38355 On Fri, Feb 8, 2013 at 3:15 AM, Paul Rubin wrote: > Chris Angelico writes: >> fd_to_sock={sock.fileno():sock for sock in list_of_sockets} >> You'd need to manually maintain that as sockets get created/destroyed, >> though > > Thanks, I was hoping to avoid that. I'll have to check how > select.select manages to return sockets. Maybe it builds such a dict > from the object list before it calls the system's select function, then > maps the result back afterwards. Ugh. Yeah, I figured fileno() probably wouldn't be news to you. I don't suppose there's anything convenient in the rest of your application that makes such a list/dict plausible? For instance, if you need to maintain a list of all current socket connections to support broadcast operations, then it's not much harder to also maintain the fd->socket mapping. ChrisA