On 28 May 2010 15:28, "Michael Hanselmann" <[email protected]> wrote:
> Could you check that the mode is in the valid set of modes here?
>> assert mode in constants.IEMS or something similar :)
>
> Calling “GetCommand”, the only public method, will check that.
>

Yes but if you ever add a different public method, or ever build the object
at some point, and then call the method later it might become harder to see
what's wrong!

>>> +    for i in [addr1, addr2]:
>>> +      for value in i:
>>> +        if "," in value:
>>> +          raise Error("Comma not allowed in socat option value: %r" %
value)
>>
>> Wouldn't it be better to check for commas in the host/port arguments
>> that go forming the addresses, rather than now after we built them?
>
> This way we also check for commas in constants.
>

But again we defer error checking rather than doing it upfront!

Thanks,

Guido

Reply via email to