Typing arguments in python
dale at riverhall.NOTHANKS.co.uk
Wed Apr 16 16:04:47 CEST 2003
Dale Strickland-Clark <dale at riverhall.NOTHANKS.co.uk> wrote:
>danra at walla.co.il (Danra) wrote:
>> if not hasattr(fileobj,'write'):
>> raise TypeError, "Given arg must have the 'write' attribute."
>You want assert, you do:
> assert hasattr(fileobj, 'write'), 'Bang! Sort your code out.'
Obviously, there's a 'not' missing from the above :-(.
Riverhall Systems Ltd
More information about the Python-list