Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #83611

Re: annoying doctest problem

Path csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'from:addr:yahoo.co.uk': 0.04; 'output': 0.05; 'string': 0.09; 'doctest': 0.09; 'escape': 0.09; 'lawrence': 0.09; 'output,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'language.': 0.14; 'behaviour.': 0.16; 'dumb.': 0.16; 'peters': 0.16; 'prefer.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'repr': 0.16; 'language': 0.16; 'wrote:': 0.18; 'programming': 0.22; 'rules': 0.22; 'tests': 0.22; 'header:User-Agent:1': 0.23; 'documented': 0.24; 'skip': 0.24; 'string,': 0.24; 'subject:problem': 0.24; 'typical': 0.24; '(or': 0.24; 'sort': 0.25; 'first,': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'thus': 0.29; 'tim': 0.29; 'comparison': 0.31; "d'aprano": 0.31; 'doc': 0.31; 'steven': 0.31; 'another': 0.32; 'text': 0.33; 'implemented': 0.33; 'actual': 0.34; 'comment': 0.34; 'problem.': 0.35; 'something': 0.35; 'impression': 0.36; "didn't": 0.36; 'should': 0.36; 'wrong': 0.37; 'expected': 0.38; 'to:addr:python-list': 0.38; 'does': 0.39; 'embedded': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'skip:u 10': 0.60; 'future': 0.60; 'simple': 0.61; 'first': 0.61; 'exchange': 0.63; 'refer': 0.63; 'our': 0.64; 'therefore,': 0.64; 'more': 0.64; 'different': 0.65; 'charset:windows-1252': 0.65; 'believe': 0.68; 'safe': 0.72; 'repeat': 0.74; 'zen': 0.84; 'mistake': 0.91
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Mark Lawrence <breamoreboy@yahoo.co.uk>
Subject Re: annoying doctest problem
Date Mon, 12 Jan 2015 14:59:49 +0000
References <0e9e5a03-2291-490e-9220-fa6744c9e2e5@googlegroups.com> <54b35a9c$0$2738$c3e8da3$76491128@news.astraweb.com> <mailman.17618.1421064945.18130.python-list@python.org> <54b3c566$0$13004$c3e8da3$5496439d@news.astraweb.com>
Mime-Version 1.0
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host host-92-24-222-48.ppp.as43234.net
User-Agent Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0
In-Reply-To <54b3c566$0$13004$c3e8da3$5496439d@news.astraweb.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.17624.1421074803.18130.python-list@python.org> (permalink)
Lines 33
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1421074803 news.xs4all.nl 2971 [2001:888:2000:d::a6]:57203
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:83611

Show key headers only | View raw


On 12/01/2015 13:00, Steven D'Aprano wrote:
> Skip Montanaro wrote:
>
>> 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.
>
> I believe that is still documented as the way to generate doctests.
>
>> 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 didn't mean to give the impression that doctest was wrong to be fussy, or
> dumb if you prefer. I think it's exactly the right behaviour.
>

If doctest is dumb then that's clearly down to the author.  Perhaps we 
should refer him or her to the Zen of Python so they don't repeat the 
mistake with future design decisions?

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

annoying doctest problem gordianknot1981@gmail.com - 2015-01-11 20:20 -0800
  Re: annoying doctest problem gordianknot1981@gmail.com - 2015-01-11 20:30 -0800
  Re: annoying doctest problem Steven D'Aprano <steve@pearwood.info> - 2015-01-12 05:24 +0000
    Re: annoying doctest problem Skip Montanaro <skip.montanaro@gmail.com> - 2015-01-12 06:15 -0600
      Re: annoying doctest problem Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-01-13 00:00 +1100
        Re: annoying doctest problem Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-01-12 14:59 +0000
          Re: annoying doctest problem Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-01-13 02:58 +1100
            Re: annoying doctest problem Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-01-12 16:46 +0000
        Re: annoying doctest problem Skip Montanaro <skip.montanaro@gmail.com> - 2015-01-12 12:15 -0600
    Re: annoying doctest problem Skip Montanaro <skip.montanaro@gmail.com> - 2015-01-12 06:32 -0600
  Re: annoying doctest problem Ned Batchelder <ned@nedbatchelder.com> - 2015-01-12 10:47 -0500
    Re: annoying doctest problem gordianknot1981@gmail.com - 2015-01-12 10:34 -0800

csiph-web