Path: csiph.com!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail From: Ian Kelly Newsgroups: comp.lang.python Subject: Re: Clean Singleton Docstrings Date: Wed, 13 Jul 2016 18:25:33 -0600 Lines: 27 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: news.uni-berlin.de +EacWd6ITLhCYRBugO62ngD7Gn4bRxYGABRYyFyvM1Yg== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'none:': 0.05; 'acceptance': 0.07; 'expressions': 0.07; 'friday,': 0.07; 'none.': 0.09; 'python': 0.10; 'exception': 0.13; 'wed,': 0.15; 'argument': 0.15; "%r'": 0.16; '2016': 0.16; 'boolean': 0.16; 'evaluates': 0.16; 'received:io': 0.16; 'received:mail-oi0-x230.google.com': 0.16; 'received:psf.io': 0.16; 'registry': 0.16; 'subject:Singleton': 0.16; 'wrote:': 0.16; '>>>': 0.20; 'fix': 0.21; 'lawrence': 0.22; 'header:In-Reply-To:1': 0.24; 'handling': 0.27; 'message-id:@mail.gmail.com': 0.27; 'module.': 0.27; 'function': 0.28; 'values': 0.28; '13,': 0.29; 'context,': 0.29; 'correct,': 0.29; 'raise': 0.29; 'putting': 0.30; 'problem': 0.33; 'received:google.com': 0.35; 'returning': 0.35; 'something': 0.35; 'instead': 0.36; 'there': 0.36; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'test': 0.39; 'to:addr:python.org': 0.40; 'still': 0.40; 'your': 0.60; 'jul': 0.72; 'object:': 0.84; 'otten': 0.84; 'to:name:python': 0.84; 'either:': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-transfer-encoding; bh=G7GXj8odW+0KVGWWpjCkWIMvzTeremXF6NjeUNrDCSE=; b=VY20tSt4RmenbbajqhyfhU6uZsmZ5y8UqUyrzNEEJIkImTnmap/Ho7jccJQaSw2dKV b4x/i9j4YHGlhHf9MOpmY906DR5d9lz69saqQplaQvbNfT1zGJmqP8kXgr5JN/UMB6Pb 7+6Gi8VKxoq7WgLt7VVDNlh+PAJvyFSxqORQUaxTA6aQt34cXCFG6l4/LvEcxeAqxYMV S6v46n08JQSf/3niGqox4CkWUrthNUM36s2Ifjzb1XgrYEwnz2/I5yN1IKBcPFfnMddG gHaDHNYKRwgDKZ0vC4DXzgUOXT/iMX3HxRaNvJqEqn94dD0v31v6KHlV5TlD+v9AoS0s Oxyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-transfer-encoding; bh=G7GXj8odW+0KVGWWpjCkWIMvzTeremXF6NjeUNrDCSE=; b=WCJjRKeA9tE2DH4QSMvR/hQ2h3pJugJlofEWvGKSxarivK3hbESIa1WjDoN81abZFg 8GNjoQlLSQdJbuNjvx/mvXxjmdWTvsTJSn8BnbLlxPthfJEvvuw+riZ/cp426mn7N5is QuU7o7BjUCoR3UGpbK4cNQmmEZoRoe1bp/qZ1fFeG9QgfjDZitvTNDbVffTPXPyHDWCf o6h1GaaXnvGJFz33pywsGvNORPwqx3dz+zsRmEu13oOKQeBAmmAhSaJn9XH/WWTrSmM4 BhI6oU4zQqCc0iV0BYQOk9/qaVyoAKX331c7qq4J/K+b1fx5Tk9fPDeict4bOSAMKpBc bvVw== X-Gm-Message-State: ALyK8tI4Md1wQ9wRflDBwj80xvOGKMCn27oWy/qNJYwD9+nQzhhdb/cdGf+7YQtZ2z2OMMwmO3c5+cilU0+JDA== X-Received: by 10.202.89.87 with SMTP id n84mr3137618oib.194.1468455972516; Wed, 13 Jul 2016 17:26:12 -0700 (PDT) In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: Xref: csiph.com comp.lang.python:111422 On Wed, Jul 13, 2016 at 5:54 PM, Peter Otten <__peter__@web.de> wrote: > Lawrence D=E2=80=99Oliveiro 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=E2=80=99s 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.