On Wed, Jul 13, 2016 at 5:54 PM, Peter Otten <__pete...@web.de> wrote:
> Lawrence D’Oliveiro wrote:
>
>> On Friday, July 8, 2016 at 7:38:56 PM UTC+12, Peter Otten wrote:
>>
>>> There is a test
>>>
>>> if not object:
>>>     raise ImportError('no Python documentation found for %r' % thing)
>>>
>>> in the pydoc module. So all you need is to ensure that your Registry
>>> evaluates to True in a boolean context, e. g. by putting something into
>>> it:
>>
>> And there are still those who think that Python’s lax acceptance of
>> non-boolean values as booleans is a good idea...
>
> I don't think this particular problem serves as an argument for stricter
> handling of boolean expressions because the fix
>
> if object is not None: ...
>
> is not completely correct, either:

A better fix would be to have the locate function raise an exception
if the thing is not found instead of returning None.
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to