On Wed, Aug 27, 2003 at 01:25:12PM +0400, Oleg Broytmann wrote: > The only problem is: sometimes you use isinstance to test if it is a > stream, and sometimes you use types: [...] > Also the order of test... You are saying here "the body can be string or > non-string, and non-strings are streams, always". I would like to invert > the meaning: "the body can be stream or non-stream, and non-streams are > converted to strings, always": Sharp eyes. The code is okay since set_body ensures that self.body is either a string or a Stream object. I used the type test because it's a little faster. Today I've come to my senses and realize that it's not worth it. Using isinstance() is clearer and less fragile (someone could change set_body() and not realize the invariant). Neil