Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2.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.042 X-Spam-Evidence: '*H*': 0.92; '*S*': 0.00; 'code"': 0.09; 'ide': 0.09; 'tests,': 0.09; 'cc:addr:python-list': 0.11; 'docstrings': 0.16; 'substitute': 0.16; 'wing': 0.16; 'exception': 0.16; 'wrote:': 0.18; 'all,': 0.19; 'pfxlen:0': 0.19; 'coding': 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; 'should': 0.36; 'unit': 0.37; 'skip:& 10': 0.38; 'nov': 0.38; 'analyze': 0.60; 'most': 0.60; 'first': 0.61; 'to:addr:gmail.com': 0.65; '"active': 0.84; 'action.': 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:from:date:message-id:subject:to :cc:content-type; bh=xp5bB8QP8prmeYsKq5XXr7yKDimM+UiDgxZTBxdh268=; b=Ef11TaoozJzO7UNa4e8x8nXFHjNlhrB4+Yeckc1cbGWrXxoz4NdzYLjB7aXmLsqpJI mFJ5EyeDbj8PHe8DaI9XKpqr0oHrbNC9WsuFobMRRR9IQgdHSFYanPRh49P4Os3+NlIP +pihrJcylVKehG6IuQns62YzyC4Cg0v/7FWv7yF61u85FqMFPxKwcJulojD6KWe349LI MJ7mm+SC7TyEG8czZSpTsD6/QAVHZSC1o43NQhSAnFw7tV0S8DKk3dDNmOPW/qOL4u34 pF4xJmRQrKEGV2NqF1qXHOZPf/Vi+JK8kRCW974DMfKQYqp/X/uQiDx5m8+IPgb/STL0 KtYw== X-Received: by 10.180.9.196 with SMTP id c4mr44384894wib.66.1415739505520; Tue, 11 Nov 2014 12:58:25 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <96c138e4-ab95-4e5f-a0c8-e696b5a926bb@googlegroups.com> References: <96c138e4-ab95-4e5f-a0c8-e696b5a926bb@googlegroups.com> From: TP Date: Tue, 11 Nov 2014 12:57:45 -0800 Subject: Re: I love assert To: Peter Cacioppi Content-Type: multipart/alternative; boundary=001a11c24302523ddd05079b8a36 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: 65 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1415739513 news.xs4all.nl 2900 [2001:888:2000:d::a6]:37818 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:80562 --001a11c24302523ddd05079b8a36 Content-Type: text/plain; charset=ISO-8859-1 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 --001a11c24302523ddd05079b8a36 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
On T= ue, Nov 11, 2014 at 11:40 AM, Peter Cacioppi <peter.cacioppi@gmail= .com> 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 exc= eption responsibilities, and, most of all, it should be used for passive in= spection and not action. But given these guidelines, I still find it very u= seful as "active comments".

I first came across asserts when us= ing Wing IDE. See "Helping Wing Analyze Code" [1] explains why us= ing assert and isinstance will let Wing IDE autocomplete things it otherwis= e couldn't.

PyCharm uses docstrings to accomplish the same task [2] but can al= so use asserts/isinstance [3].

--001a11c24302523ddd05079b8a36--