[Python-Dev] Add LRUCache class to stdlib

2011-06-05 Thread Nadeem Vawda
I would like to propose adding a class to the stdlib to provide a more flexible LRU caching mechanism. As things stand, the functools.lru_cache() decorator is fine for memoization of pure functions, but does not accommodate situations where cache entries become stale and must be invalidated/updated

Re: [Python-Dev] The socket HOWTO

2011-06-05 Thread exarkun
On 5 Jun, 10:35 pm, mar...@v.loewis.de wrote: First, Twisted doesn't always use the BSD sockets API; the Windows IOCP reactor, especially, starts off with the socket() function, but things go off in a different direction pretty quickly from there. Hmm. Are you saying it doesn't use listen, con

Re: [Python-Dev] The socket HOWTO

2011-06-05 Thread Martin v. Löwis
> First, Twisted doesn't always use the BSD sockets API; the Windows IOCP > reactor, especially, starts off with the socket() function, but things > go off in a different direction pretty quickly from there. Hmm. Are you saying it doesn't use listen, connect, bind, send, recv? To me, that's the co

Re: [Python-Dev] The socket HOWTO

2011-06-05 Thread Martin v. Löwis
>>> I'm not sure why the examples are good (for example, modern client >>> code should probably use create_connection() with a host name, not >>> connect()). >> >> I disagree. create_connection is an advanced function - you shouldn't >> be using it unless you know what it is doing. > > Can you exp

Re: [Python-Dev] The socket HOWTO

2011-06-05 Thread Raymond Hettinger
> On Jun 4, 2011, at 11:32 PM, Martin v. Löwis wrote: > >> b) telling people to use Twisted or asyncore on the server side >> if they are new to sockets is bad advice. People *first* have >> to understand sockets, and *then* can use these libraries >> and frameworks. Those libraries aren't

Re: [Python-Dev] The socket HOWTO

2011-06-05 Thread Glyph Lefkowitz
On Jun 4, 2011, at 11:32 PM, Martin v. Löwis wrote: > b) telling people to use Twisted or asyncore on the server side > if they are new to sockets is bad advice. People *first* have > to understand sockets, and *then* can use these libraries > and frameworks. Those libraries aren't made to b

Re: [Python-Dev] keyword-only arguments and varags

2011-06-05 Thread Benjamin Peterson
2011/6/5 Nick Coghlan : > On Sun, Jun 5, 2011 at 11:45 AM, Benjamin Peterson > wrote: >> Currently, >> >> def f(*, kw, **kwargs): pass >> >> is valid syntax, but >> >> def f(*args, *, kw): pass >> >> is not. >> >> I don't see any mention of it in the PEP but perhaps there is a good >> reason this

[Python-Dev] FWD: gpg keys have problems

2011-06-05 Thread Aahz
I'm not currently reading python-dev, dunno if this has come up before: - Forwarded message from "Michael J. Dinneen" - > Date: Sun, 05 Jun 2011 19:33:04 +1200 > From: "Michael J. Dinneen" > To: webmas...@python.org > Subject: gpg keys have problems > Organization: University of Aucklan

Re: [Python-Dev] The socket HOWTO

2011-06-05 Thread Antoine Pitrou
On Sun, 05 Jun 2011 08:32:38 +0200 "Martin v. Löwis" wrote: > >> -1. I think there should be a Python-oriented introduction to sockets. > >> You may have complaints about the specific wording of the text, but > >> please understand that these are probably irrelevant to most > >> first-time readers

Re: [Python-Dev] [Python-checkins] cpython (3.1): Do not add txt files twice.

2011-06-05 Thread Victor Stinner
I added the "if dir=='cjkencodings':" to msi.py, based on tests for other subdirectories in Lib/tests/. Can you explain me why cjkencodings should not have a special case? The fix should maybe be ported to 3.2, 3.3 and 2.7. Victor Le dimanche 05 juin 2011 11:00:30, martin.v.loewis a écrit : > h