Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.048 X-Spam-Evidence: '*H*': 0.90; '*S*': 0.00; 'code"': 0.09; 'ide': 0.09; 'tests,': 0.09; 'cc:addr:python-list': 0.11; '12:57': 0.16; 'docstrings': 0.16; 'substitute': 0.16; 'wing': 0.16; 'exception': 0.16; 'wrote:': 0.18; 'all,': 0.19; 'coding': 0.22; 'email addr:gmail.com>': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'task': 0.26; 'header:In-Reply-To:1': 0.27; '[1]': 0.29; 'am,': 0.29; "doesn't": 0.30; '[2]': 0.30; 'message- id:@mail.gmail.com': 0.30; 'assert': 0.31; 'basic': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'explains': 0.36; 'useful': 0.36; 'thanks': 0.36; 'should': 0.36; 'unit': 0.37; 'skip:& 10': 0.38; 'nov': 0.38; 'pm,': 0.38; 'analyze': 0.60; 'most': 0.60; 'first': 0.61; 'to:addr:gmail.com': 0.65; '"active': 0.84; 'action.': 0.84; 'keeper': 0.84; 'url:edit': 0.84; 'passive': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=74bBi53GrfAGcpUkc8cz4pX9I9VrxvQQIDHq5rZn3GM=; b=QZQ+3RGlepg7ZrV1GbzRj9Xdc05p9V2b8BLFujAA5Pv4U1mjwslwextslHrgZgnVXF MtBBJoXX73oLqI1ejMf+tV95Fn+sx+xP11wQpWSr0yM4kYFnqSY/VxKH9IGResy63dTk t/rkHU6/ErcHE1QT+5+5+/8QYrbfMmfIoKKtB6kFAg7/zdBhyo2hPPJU8iOoEML5K6dm X6Gjv969t4DGdrS68v3hVMmAlSgEk3EQKDB9g8dvXuOXIth1+dxWJovWTo7GeNEhEiUs rn7X/8o6IVqO8dpYHE22ZkMhBoVArWvjhhIko8et+eRU1xhfiBalWHuC8VtdxvXvKXpS X4+Q== MIME-Version: 1.0 X-Received: by 10.202.175.74 with SMTP id y71mr3694236oie.79.1415746961839; Tue, 11 Nov 2014 15:02:41 -0800 (PST) In-Reply-To: References: <96c138e4-ab95-4e5f-a0c8-e696b5a926bb@googlegroups.com> Date: Tue, 11 Nov 2014 15:02:41 -0800 Subject: Re: I love assert From: Peter Cacioppi To: TP Content-Type: multipart/alternative; boundary=001a113ce406c09deb05079d467e Cc: "python-list@python.org" X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 76 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1415746970 news.xs4all.nl 2945 [2001:888:2000:d::a6]:50694 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:80575 --001a113ce406c09deb05079d467e Content-Type: text/plain; charset=UTF-8 On Tue, Nov 11, 2014 at 12:57 PM, TP wrote: > On Tue, Nov 11, 2014 at 11:40 AM, Peter Cacioppi > wrote: > >> I think one needs to take care with some basic assert coding - it's not a >> substitute for unit tests, it doesn't absolve you of normal exception >> responsibilities, and, most of all, it should be used for passive >> inspection and not action. But given these guidelines, I still find it very >> useful as "active comments". > > > I first came across asserts when using Wing IDE. See "Helping Wing Analyze > Code" [1] explains why using assert and isinstance will let Wing IDE > autocomplete things it otherwise couldn't. > > PyCharm uses docstrings to accomplish the same task [2] but can also use > asserts/isinstance [3]. > > [1] https://wingware.com/doc/edit/helping-wing-analyze-code > > [2] https://www.jetbrains.com/pycharm/webhelp/type-hinting-in-pycharm.html > > > [3] > http://stackoverflow.com/questions/9040387/is-there-a-way-to-explicitly-tell-pycharm-what-class-an-attribute-is-an-instance > > I use PyCharm. Thanks for [2], it's a keeper --001a113ce406c09deb05079d467e Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

= On Tue, Nov 11, 2014 at 12:57 PM, TP <wingusr@gmail.com> wro= te:
On Tue, Nov 11, 2014 at 11:40 AM, Peter C= acioppi <peter.cacioppi@gmail.com> wrote:
I think one needs to take care wi= th some basic assert coding - it's not a substitute for unit tests, it = doesn't absolve you of normal exception responsibilities, and, most of = all, it should be used for passive inspection and not action. But given the= se guidelines, I still find it very useful as "active comments".<= /blockquote>

I first came across as= serts when using Wing IDE. See "Helping Wing Analyze Code" [1] ex= plains why using assert and isinstance will let Wing IDE autocomplete thing= s it otherwise couldn't.

Py= Charm uses docstrings to accomplish the same task [2] but can also use asse= rts/isinstance [3].


--001a113ce406c09deb05079d467e--