Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-21 Thread Olemis Lang
On 5/20/13, Mark Janssen wrote: >>> * Doctests practically beg you to write your code first and then copy >>> and >>> paste terminal sessions - they're the enemy of TDD >> >> Of course , not , all the opposite . If the approach is understood >> correctly then the first thing test author will do is

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-20 Thread Mark Janssen
>> * Doctests practically beg you to write your code first and then copy and >> paste terminal sessions - they're the enemy of TDD > > Of course , not , all the opposite . If the approach is understood > correctly then the first thing test author will do is to write the > code «expected» to get som

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-20 Thread Olemis Lang
On 5/20/13, Olemis Lang wrote: [...] > On 5/20/13, Michael Foord wrote: [...] > >> * Tool support for editing within doctests is *generally* worse > > this is true , let's do it ! > [...] >> * Typing >>> and ... all the time is really annoying > > ... I have faith ... there should be something li

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-20 Thread Olemis Lang
Hi ! ... sorry , I could not avoid to reply this message ... On 5/20/13, Michael Foord wrote: > > On 20 May 2013, at 18:26, Mark Janssen wrote: > I'm hoping that core developers don't get caught-up in the "doctests are bad meme". Instead, we should be clear about their p

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-20 Thread Glenn Linderman
On 5/19/2013 9:08 PM, Ethan Furman wrote: On 05/19/2013 05:24 PM, Nick Coghlan wrote: This is the point I was trying to make: once you use IntEnum (as you would in any case where you need bitwise operators), Enum gets out of the way for everything other than __str__, __repr__, and one other slo

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-20 Thread Barry Warsaw
I don't think a python-dev discussion about the value of doctests is going to change minds one way or the other, but I just *had* to respond to this one point: On May 20, 2013, at 11:26 PM, Michael Foord wrote: >* Doctests practically beg you to write your code first and then copy and >* paste te

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-20 Thread Michael Foord
On 20 May 2013, at 18:26, Mark Janssen wrote: >>> I'm hoping that core developers don't get caught-up in the "doctests are bad >>> meme". >>> >>> Instead, we should be clear about their primary purpose which is to test >>> the examples given in docstrings. >>> In other words, doctests have a pe

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-20 Thread Olemis Lang
On 5/19/13, Steven D'Aprano wrote: > On 20/05/13 09:27, Gregory P. Smith wrote: >> On Sat, May 18, 2013 at 11:41 PM, Raymond Hettinger < >> raymond.hettin...@gmail.com> wrote: >> >>> >>> On May 14, 2013, at 9:39 AM, Gregory P. Smith wrote: >>> >>> Bad: doctests. >>> >>> >>> I'm hoping that core d

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-20 Thread Mark Janssen
>> I'm hoping that core developers don't get caught-up in the "doctests are bad >> meme". >> >> Instead, we should be clear about their primary purpose which is to test >> the examples given in docstrings. >> In other words, doctests have a perfectly legitimate use case. > > But more than just one

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-20 Thread Olemis Lang
-- Forwarded message -- From: Olemis Lang Date: Mon, 20 May 2013 11:33:42 -0500 Subject: Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum] To: Antoine Pitrou On 5/20/13, Antoine Pitrou wrote: > On Sat, 18 May 2013 23:41:59 -0700 > Raymond Hettinger

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-20 Thread Olemis Lang
Hi ! :) I'll be replying some individual messages in this thread in spite of putting my replies in the right context . Sorry if I repeat something , or this makes the thread hard to read . Indeed , IMHO this is a subject suitable to discuss in TiP ML . On 5/19/13, Gregory P. Smith wrote: > On Sa

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-20 Thread Antoine Pitrou
On Tue, 21 May 2013 02:00:32 +1000 Steven D'Aprano wrote: > On 20/05/13 23:38, Antoine Pitrou wrote: > > On Mon, 20 May 2013 23:32:10 +1000 > > Steven D'Aprano wrote: > >> On 20/05/13 20:45, Antoine Pitrou wrote: > >>> On Sat, 18 May 2013 23:41:59 -0700 > >>> Raymond Hettinger wrote: > > >

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-20 Thread Steven D'Aprano
On 20/05/13 23:38, Antoine Pitrou wrote: On Mon, 20 May 2013 23:32:10 +1000 Steven D'Aprano wrote: On 20/05/13 20:45, Antoine Pitrou wrote: On Sat, 18 May 2013 23:41:59 -0700 Raymond Hettinger wrote: We should continue to encourage users to make thorough unit tests and to leave doctests for

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-20 Thread Barry Warsaw
On May 19, 2013, at 04:27 PM, Gregory P. Smith wrote: >Idea: I don't believe anybody has written a fixer for lib2to3 that applies >fixers to doctests. That'd be an interesting project for someone. I'm not sure that's true. I don't use 2to3 anymore if I can help it, but I'm pretty sure you can 2

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-20 Thread Barry Warsaw
On May 19, 2013, at 07:28 PM, Tim Peters wrote: >But more than just one ;-) Another great use has nothing to do with >docstrings: using an entire file as "a doctest". This encourages >writing lots of text explaining what you're doing,. with snippets of >code interspersed to illustrate that the

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-20 Thread Barry Warsaw
On May 18, 2013, at 11:41 PM, Raymond Hettinger wrote: >I'm hoping that core developers don't get caught-up in the "doctests are bad >meme". Thanks for your message Raymond. I know that doctests are controversial, but I do firmly believe that when used correctly, they have value and should not b

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-20 Thread R. David Murray
On Mon, 20 May 2013 15:57:35 +0200, Antoine Pitrou wrote: > On Mon, 20 May 2013 09:37:32 -0400 > "R. David Murray" wrote: > > On Mon, 20 May 2013 12:45:57 +0200, Antoine Pitrou > > wrote: > > > On Sat, 18 May 2013 23:41:59 -0700 > > > Raymond Hettinger wrote: > > > > > > > > We should continu

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-20 Thread Antoine Pitrou
On Mon, 20 May 2013 09:37:32 -0400 "R. David Murray" wrote: > On Mon, 20 May 2013 12:45:57 +0200, Antoine Pitrou > wrote: > > On Sat, 18 May 2013 23:41:59 -0700 > > Raymond Hettinger wrote: > > > > > > We should continue to encourage users to make thorough unit tests > > > and to leave doctest

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-20 Thread R. David Murray
On Mon, 20 May 2013 12:45:57 +0200, Antoine Pitrou wrote: > On Sat, 18 May 2013 23:41:59 -0700 > Raymond Hettinger wrote: > > > > We should continue to encourage users to make thorough unit tests > > and to leave doctests for documentation. That said, it should be > > recognized that some testi

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-20 Thread Antoine Pitrou
On Mon, 20 May 2013 23:32:10 +1000 Steven D'Aprano wrote: > On 20/05/13 20:45, Antoine Pitrou wrote: > > On Sat, 18 May 2013 23:41:59 -0700 > > Raymond Hettinger wrote: > >> > >> We should continue to encourage users to make thorough unit tests > >> and to leave doctests for documentation. That

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-20 Thread Steven D'Aprano
On 20/05/13 20:45, Antoine Pitrou wrote: On Sat, 18 May 2013 23:41:59 -0700 Raymond Hettinger wrote: We should continue to encourage users to make thorough unit tests and to leave doctests for documentation. That said, it should be recognized that some testing is better than no testing. And

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-20 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 05/19/2013 07:22 PM, Mark Janssen wrote: > On Sun, May 19, 2013 at 1:13 PM, Tres Seaver > wrote: >> -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 >> >> On 05/19/2013 10:48 AM, Guido van Rossum wrote: >>> Anyway, if you're doing arithmetic on enums

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-20 Thread Antoine Pitrou
On Sat, 18 May 2013 23:41:59 -0700 Raymond Hettinger wrote: > > We should continue to encourage users to make thorough unit tests > and to leave doctests for documentation. That said, it should be > recognized that some testing is better than no testing. And doctests > may be attractive in that

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-19 Thread Lennart Regebro
On Mon, May 20, 2013 at 1:51 AM, Gregory P. Smith wrote: > > On May 19, 2013 4:31 PM, "Benjamin Peterson" wrote: >> >> 2013/5/19 Gregory P. Smith : >> > Idea: I don't believe anybody has written a fixer for lib2to3 that >> > applies >> > fixers to doctests. That'd be an interesting project for s

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-19 Thread Ethan Furman
On 05/19/2013 05:24 PM, Nick Coghlan wrote: This is the point I was trying to make: once you use IntEnum (as you would in any case where you need bitwise operators), Enum gets out of the way for everything other than __str__, __repr__, and one other slot (that escapes me for the moment...). __

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-19 Thread Stephen J. Turnbull
Gregory P. Smith writes: > I really do applaud the goal of keeping examples in documentation up to > date. But doctest as it is today is the wrong approach to that. A repr > mismatch does not mean the example is out of date. Of course it does. The user sees something in the doc that's differ

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-19 Thread Steven D'Aprano
On 20/05/13 09:27, Gregory P. Smith wrote: On Sat, May 18, 2013 at 11:41 PM, Raymond Hettinger < raymond.hettin...@gmail.com> wrote: On May 14, 2013, at 9:39 AM, Gregory P. Smith wrote: Bad: doctests. I'm hoping that core developers don't get caught-up in the "doctests are bad meme". So

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-19 Thread Tim Peters
[Raymond Hettinger] > I'm hoping that core developers don't get caught-up in the "doctests are bad > meme". > > Instead, we should be clear about their primary purpose which is to test > the examples given in docstrings. I disagree. > In many cases, there is a great deal of benefit to docstrin

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-19 Thread Nick Coghlan
On Mon, May 20, 2013 at 10:14 AM, Antoine Pitrou wrote: > On Sun, 19 May 2013 20:04:03 -0400 > Ned Batchelder wrote: >> On 5/19/2013 7:22 PM, Mark Janssen wrote: >> > On Sun, May 19, 2013 at 1:13 PM, Tres Seaver wrote: >> >> -BEGIN PGP SIGNED MESSAGE- >> >> Hash: SHA1 >> >> >> >> On 05/1

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-19 Thread Antoine Pitrou
On Sun, 19 May 2013 20:04:03 -0400 Ned Batchelder wrote: > On 5/19/2013 7:22 PM, Mark Janssen wrote: > > On Sun, May 19, 2013 at 1:13 PM, Tres Seaver wrote: > >> -BEGIN PGP SIGNED MESSAGE- > >> Hash: SHA1 > >> > >> On 05/19/2013 10:48 AM, Guido van Rossum wrote: > >>> Anyway, if you're do

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-19 Thread Ned Batchelder
On 5/19/2013 7:22 PM, Mark Janssen wrote: On Sun, May 19, 2013 at 1:13 PM, Tres Seaver wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 05/19/2013 10:48 AM, Guido van Rossum wrote: Anyway, if you're doing arithmetic on enums you're doing it wrong. Hmm, bitwise operations, even? I thi

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-19 Thread Gregory P. Smith
On May 19, 2013 4:31 PM, "Benjamin Peterson" wrote: > > 2013/5/19 Gregory P. Smith : > > Idea: I don't believe anybody has written a fixer for lib2to3 that applies > > fixers to doctests. That'd be an interesting project for someone. > > 2to3 can operate on doctests, though it doesn't do anything

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-19 Thread Benjamin Peterson
2013/5/19 Gregory P. Smith : > Idea: I don't believe anybody has written a fixer for lib2to3 that applies > fixers to doctests. That'd be an interesting project for someone. 2to3 can operate on doctests, though it doesn't do anything different to them than it does to normal sourcecode. -- Regar

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-19 Thread Gregory P. Smith
On Sat, May 18, 2013 at 11:41 PM, Raymond Hettinger < raymond.hettin...@gmail.com> wrote: > > On May 14, 2013, at 9:39 AM, Gregory P. Smith wrote: > > Bad: doctests. > > > I'm hoping that core developers don't get caught-up in the "doctests are > bad meme". > So long as doctests insist on compar

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-19 Thread Mark Janssen
On Sun, May 19, 2013 at 1:13 PM, Tres Seaver wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On 05/19/2013 10:48 AM, Guido van Rossum wrote: >> Anyway, if you're doing arithmetic on enums you're doing it wrong. > > Hmm, bitwise operations, even? I think it's rather pointless to do bi

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-19 Thread Nick Coghlan
On 20 May 2013 06:25, "Terry Jan Reedy" wrote: > > On 5/19/2013 4:13 PM, Tres Seaver wrote: >> >> -BEGIN PGP SIGNED MESSAGE- >> Hash: SHA1 >> >> On 05/19/2013 10:48 AM, Guido van Rossum wrote: >>> >>> Anyway, if you're doing arithmetic on enums you're doing it wrong. >> >> >> Hmm, bitwise

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-19 Thread Terry Jan Reedy
On 5/19/2013 4:13 PM, Tres Seaver wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 05/19/2013 10:48 AM, Guido van Rossum wrote: Anyway, if you're doing arithmetic on enums you're doing it wrong. Hmm, bitwise operations, even? Those are logic, not arithmetic as usually understood. (Th

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-19 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 05/19/2013 12:14 PM, Dan Stromberg wrote: > On Sat, May 18, 2013 at 11:41 PM, Raymond Hettinger < > raymond.hettin...@gmail.com> wrote: > >> >> On May 14, 2013, at 9:39 AM, Gregory P. Smith >> wrote: >> >> Bad: doctests. >> >> >> I'm hoping t

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-19 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 05/19/2013 10:48 AM, Guido van Rossum wrote: > Anyway, if you're doing arithmetic on enums you're doing it wrong. Hmm, bitwise operations, even? Tres. - -- === Tres Seaver

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-19 Thread Dan Stromberg
On Sat, May 18, 2013 at 11:41 PM, Raymond Hettinger < raymond.hettin...@gmail.com> wrote: > > On May 14, 2013, at 9:39 AM, Gregory P. Smith wrote: > > Bad: doctests. > > > I'm hoping that core developers don't get caught-up in the "doctests are > bad meme". > Don't doctests intended for CPython

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-19 Thread Guido van Rossum
Anyway, if you're doing arithmetic on enums you're doing it wrong.  — Sent from Mailbox On Sun, May 19, 2013 at 4:55 AM, Nick Coghlan wrote: > On Sun, May 19, 2013 at 4:41 PM, Raymond Hettinger > wrote: >> nicer repr" is worth "Sorry, I broke your tests, made your published >> examples >> out o

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-19 Thread Nick Coghlan
On Sun, May 19, 2013 at 4:41 PM, Raymond Hettinger wrote: > nicer repr" is worth "Sorry, I broke your tests, made your published > examples > out of date, and slowed down your code." While the first two considerations are always potentially applicable when using enums, the latter should only be t

Re: [Python-Dev] Purpose of Doctests [Was: Best practices for Enum]

2013-05-18 Thread Raymond Hettinger
On May 14, 2013, at 9:39 AM, Gregory P. Smith wrote: > Bad: doctests. I'm hoping that core developers don't get caught-up in the "doctests are bad meme". Instead, we should be clear about their primary purpose which is to test the examples given in docstrings. In many cases, there is a gre