Matt Nordhoff wrote:
> Michael Foord wrote:
>
>> Matt Nordhoff wrote:
>>
>>> Hi.
>>>
>>> Python's hasattr() function swallows all exceptions, including things
>>> like KeyboardInterrupt. Therefore, one project I tinker on (Bazaar) uses
>>> "getattr(object, 'attribute', None) is not None" instead. Here's a patch
>>> to change that in ConfigObj (and pathutils).
>>>
>>> Of course, that is subtly different, so you should verify it's ok. I
>>> didn't run ConfigObj's test suite (unless it has no output and takes 1
>>> second, in which case I did), but I did run Bazaar's test suite with
>>> this change and nothing broke.
>>>
>>>
>> Is the current use of hasattr *actually* causing any problems - or is it
>> to avoid potential problems?
>>
>
> To avoid potential problems.
>
>
>> I can see any problem with the patch though... (not likely to be a new
>> release *soon* but can apply to SVN).
>>
>
> "can" or "can't"?
>
>
Well the patch looks harmless enough and not likely to confuse - so I
meant 'can'. I doubt the problem it solves is ever likely to be a real
problem though... :-)
Michael
>> Michael Foord
>> http://www.manning.com/foord
>>
>
> Hmm, I didn't mean this message to be so terse..
>
|