From: Jeremy Bopp Date: 2012-09-05T05:27:35+09:00 Subject: Re: Socket Decorator On 09/04/2012 02:19 PM, Bernhard Brodowsky wrote: > Bernhard Brodowsky wrote in post #1074683: >> I still need to figure out some things, for example >> your code heavily relies on the exceptions I throw and I have to figure >> out which ones I have to throw in which occasions such that all things >> like blocking and non-blocking reads work properly and what I have to do >> to end the connection suddenly without your code catching it and I will >> have to watch out if there are occasions where a call to >> unbuffered_read() blocks because not enough data is available where it >> should not or should throw an exception instead. > > Ok, I found out everything I wanted to now is in the comment of the > module itself and it works now, so thanks a lot. Good deal. The problem with documenting mixins is finding a place to document the methods a mixin needs to have defined. BTW, for everyone reading this thread, if there are any suggestions for a better way to manage this, I would appreciate them. > But I have one little flaw report: In your LikeStringIO example, you > didn't define duplexed? to return true. That's not actually a bug. The string upon which a LikeStringIO instance operates could be thought of as an in-memory file opened in read-write mode. Reading and writing to an instance of LikeStringIO are not independent operations. Performing one operation has consequences/side effects for the other (the file pointer moves), contrary to a duplexed IO. A duplexed IO might read from one file and write to a different file or a socket, for example. :-) -Jeremy