danra at walla.co.il (Danra) wrote: >def f(fileobj): > if not hasattr(fileobj,'write'): > raise TypeError, "Given arg must have the 'write' attribute." > . > . > fileobj.write('...') You want assert, you do: def f(fileobj): assert hasattr(fileobj, 'write'), 'Bang! Sort your code out.' -- Dale Strickland-Clark Riverhall Systems Ltd