On Fri, Mar 25, 2011 at 2:40 AM, Jesus Cea <j...@jcea.es> wrote: > What do you think?. Should I write a PEP? (I don't think so, but your > opinion matters). I care, for instance, about how to garantee the API > coverage actually needed for the new "socket-like" object. The idea is > that your object should be "socket-like", but how much "socket-like" in > the API sense?. Do you need to implement "getpeername()" for injecting > in smtplib?. > > If you agree that this is a nice idea, what other libs do you think that > could benefice of being "injected", beside "socket"?.
1. A PEP is definitely needed to thrash out how this API should work in practice, as well as whether or not it should even be done at all 2. The level at which the dependency injection works (function arguments, class attributes, module globals) needs to be decided 3. Alternative designs (such as standardised tools for thread-safe monkey patching or other customisation of affected libraries) should be considered As an example of the last point, perhaps rather than modifying all the *clients* of the socket module, it may make more sense to have tools in the socket module itself to temporarily customise the socket creation process in the current thread. The advantage of such an approach is that it would then work for 3rd party libraries that create sockets, without requiring any further modification. Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com