Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed3.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.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python.': 0.02; 'output': 0.05; 'string': 0.09; 'doctest': 0.09; 'escape': 0.09; 'output,': 0.09; 'cc:addr:python-list': 0.11; 'dumb.': 0.16; 'peters': 0.16; 'repr': 0.16; 'to:addr:pearwood.info': 0.16; "to:name:steven d'aprano": 0.16; 'language': 0.16; 'programming': 0.22; 'rules': 0.22; 'tests': 0.22; 'cc:addr:python.org': 0.22; 'skip': 0.24; 'string,': 0.24; 'subject:problem': 0.24; 'typical': 0.24; '(or': 0.24; 'cc:2**0': 0.24; 'sort': 0.25; 'first,': 0.26; 'header:In- Reply-To:1': 0.27; 'thus': 0.29; 'tim': 0.29; 'message- id:@mail.gmail.com': 0.30; 'comparison': 0.31; 'doc': 0.31; 'another': 0.32; 'text': 0.33; 'implemented': 0.33; 'actual': 0.34; 'comment': 0.34; 'problem.': 0.35; 'something': 0.35; 'received:google.com': 0.35; 'expected': 0.38; 'does': 0.39; 'embedded': 0.39; 'skip:u 10': 0.60; 'simple': 0.61; 'first': 0.61; 'exchange': 0.63; 'therefore,': 0.64; 'more': 0.64; 'different': 0.65; 'safe': 0.72 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=tbmuZtPWMDRRXZevdOQLINuFxZ9vgKnVJoKST/kxW10=; b=wi4MB4gPSGLxqroKePuJw5lqZyG2Y7OhB+p/Wtgq/PXs7hia32gccWiRl9zm1glenu cJrqTz0d7Ge1s9EwxMOjNq9B/V0721OUU2GktrybROQnObCdMzzGi2b6RHcJSu7JoUmT KYKVDh31pegWcx+NfGu6o/ksPwMSPYweiBrV0Kt842oVSc6XrbbVBV8wShUpkjqve7Yi GhbGeQzsl1kV0QDr3RMQlccNtwzvx6iATMpxC3dIEwuxoeuqAy591cq5lFYtZNIYmuI0 RXxtVWSNndWyHO5bZEsl1TLJm1mOZ3ZdbSjGEUjPtdFxSaRiAhgfOr432tSuD6ZNS8LX wI5Q== MIME-Version: 1.0 X-Received: by 10.202.60.4 with SMTP id j4mr15956039oia.83.1421064943306; Mon, 12 Jan 2015 04:15:43 -0800 (PST) In-Reply-To: <54b35a9c$0$2738$c3e8da3$76491128@news.astraweb.com> References: <0e9e5a03-2291-490e-9220-fa6744c9e2e5@googlegroups.com> <54b35a9c$0$2738$c3e8da3$76491128@news.astraweb.com> Date: Mon, 12 Jan 2015 06:15:42 -0600 Subject: Re: annoying doctest problem From: Skip Montanaro To: "Steven D'Aprano" Content-Type: multipart/alternative; boundary=001a113cd36e260ef8050c737723 Cc: Python 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: 40 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1421064945 news.xs4all.nl 2936 [2001:888:2000:d::a6]:36309 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:83604 --001a113cd36e260ef8050c737723 Content-Type: text/plain; charset=UTF-8 ISTR that when Tim Peters first implemented first, the typical way you were expected to get tests into a doc string was to copy from an interactive session, which would not have this problem. Also, to Steven's comment about fussiness, it isn't so much that it's fussy. It's more that it's dumb. I just does a simple string comparison of the expected and actual outputs. It would be impossible for doctest to know whether the expected output was something like repr or str output, and thus safe to exchange single for double (don't forget to escape other embedded quotes!), or was some sort of user-generated string, perhaps intended to be text in another programming language which has different quoting rules than Python. Therefore, fussy (or dumb) is exactly what you want. I-said-what-I-meant-ly y'rs, Skip --001a113cd36e260ef8050c737723 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

ISTR that when Tim Peters first implemented first, the typic= al way you were expected to get tests into a doc string was to copy from an= interactive session, which would not have this problem.

Also, to Steven's comment about fussiness, it isn't = so much that it's fussy. It's more that it's dumb. I just does = a simple string comparison of the expected and actual outputs. It would be = impossible for doctest to know whether the expected output was something li= ke repr or str output, and thus safe to exchange single for double (don'= ;t forget to escape other embedded quotes!), or was some sort of user-gener= ated string, perhaps intended to be text in=C2=A0 another programming langu= age which has different quoting rules than Python. Therefore, fussy (or dum= b) is exactly what you want.

I-said-what-I-meant-ly y'rs,

Skip

--001a113cd36e260ef8050c737723--