Re: Doctest failing

2011-09-11 Thread Tigerstyle
On 10 Sep, 19:59, Terry Reedy tjre...@udel.edu wrote: On 9/10/2011 7:20 AM, Tigerstyle wrote: Hi guys. I'm strugglin with some homework stuff and am hoping you can help me out here. We appreciate you saying so instead of hiding that this is homework. small_words = ('into',

Re: Doctest failing

2011-09-11 Thread Tigerstyle
On 10 Sep, 13:50, Thomas Jollans t...@jollybox.de wrote: On 10/09/11 13:20, Tigerstyle wrote: Hi guys. I'm strugglin with some homework stuff and am hoping you can help me out here. All tests are failing even though I am getting the correct output on the first two tests. And the last

Re: Doctest failing

2011-09-11 Thread Tigerstyle
On 10 Sep, 13:43, Mel mwil...@the-wire.com wrote: Tigerstyle wrote: Hi guys. I'm strugglin with some homework stuff and am hoping you can help me out here. This is the code: small_words = ('into', 'the', 'a', 'of', 'at', 'in', 'for', 'on') def book_title(title):     Takes a

Re: Doctest failing

2011-09-11 Thread Tigerstyle
On 10 Sep, 17:56, Chris Angelico ros...@gmail.com wrote: On Sat, Sep 10, 2011 at 10:24 PM, Alister Ware alister.w...@ntlworld.com wrote: Ignoring the docttests my process would be to process each word then manually capitalize he 1st word, .I would als0 use a comprehension as makes for

Re: Doctest failing

2011-09-11 Thread Tigerstyle
On 11 Sep, 08:18, Dennis Lee Bieber wlfr...@ix.netcom.com wrote: On Sat, 10 Sep 2011 16:25:42 -0700, Dennis Lee Bieber wlfr...@ix.netcom.com declaimed the following in gmane.comp.python.general: in the language documentation... It will give you a simple way to know if you are looking at

Re: Doctest failing

2011-09-11 Thread Tigerstyle
On 11 Sep, 04:12, t...@thsu.org wrote: On Sep 10, 7:47 am, Peter Otten __pete...@web.de wrote: Tigerstyle wrote: I'm strugglin with some homework stuff and am hoping you can help me out here. This is the code: small_words = ('into', 'the', 'a', 'of', 'at', 'in', 'for',

Re: Doctest failing

2011-09-11 Thread Terry Reedy
On 9/11/2011 7:46 AM, Tigerstyle wrote: Thank you Terry, I went for this solution as it was the easiest for me to understand and comment myself keeping in mind what level I am at right now. Thanks a ton to everyone for sharing so much information and making it easy to read and understand

Re: Doctest failing

2011-09-11 Thread Ethan Furman
Chris Angelico wrote: On Sat, Sep 10, 2011 at 10:24 PM, Alister Ware alister.w...@ntlworld.com wrote: Ignoring the docttests my process would be to process each word then manually capitalize he 1st word, .I would als0 use a comprehension as makes for cleaner code:- def capitalize(word): if

Re: Doctest failing

2011-09-11 Thread Chris Angelico
On Mon, Sep 12, 2011 at 4:43 AM, Ethan Furman et...@stoneleaf.us wrote: Chris Angelico wrote: And I'd do this with a lambda, but that's just me. Of course, if your logic is more complicated, it makes more sense to keep it in a named function, but a single conditional call can fit nicely into

Re: Doctest failing

2011-09-11 Thread Ben Finney
Chris Angelico ros...@gmail.com writes: A lambda is basically a function defined in an expression. For instance: def add_one(x): return x+1 is (practically) the same as: add_one = lambda x: x+1 Those are only practically the same if you ignore the practical worth of a function knowing

Re: Doctest failing

2011-09-11 Thread Chris Angelico
On Mon, Sep 12, 2011 at 11:37 AM, Ben Finney ben+pyt...@benfinney.id.au wrote: Those are only practically the same if you ignore the practical worth of a function knowing the name it was defined with. The latter does not have that, hence I don't see it as practically the same as the former. I

Re: Doctest failing

2011-09-11 Thread Steven D'Aprano
On Mon, 12 Sep 2011 01:06 pm Chris Angelico wrote: On Mon, Sep 12, 2011 at 11:37 AM, Ben Finney ben+pyt...@benfinney.id.au wrote: Those are only practically the same if you ignore the practical worth of a function knowing the name it was defined with. The latter does not have that, hence I

Doctest failing

2011-09-10 Thread Tigerstyle
Hi guys. I'm strugglin with some homework stuff and am hoping you can help me out here. This is the code: small_words = ('into', 'the', 'a', 'of', 'at', 'in', 'for', 'on') def book_title(title): Takes a string and returns a title-case string. All words EXCEPT for small words are made

Re: Doctest failing

2011-09-10 Thread Mel
Tigerstyle wrote: Hi guys. I'm strugglin with some homework stuff and am hoping you can help me out here. This is the code: small_words = ('into', 'the', 'a', 'of', 'at', 'in', 'for', 'on') def book_title(title): Takes a string and returns a title-case string. All words

Re: Doctest failing

2011-09-10 Thread Peter Otten
Tigerstyle wrote: I'm strugglin with some homework stuff and am hoping you can help me out here. This is the code: small_words = ('into', 'the', 'a', 'of', 'at', 'in', 'for', 'on') new_title = [] title_split = title.strip().lower().split() for word in title_split:

Re: Doctest failing

2011-09-10 Thread Thomas Jollans
On 10/09/11 13:20, Tigerstyle wrote: Hi guys. I'm strugglin with some homework stuff and am hoping you can help me out here. All tests are failing even though I am getting the correct output on the first two tests. And the last test still gives me Of instead of of Cannot reproduce. I

Re: Doctest failing

2011-09-10 Thread Alister Ware
On Sat, 10 Sep 2011 04:20:17 -0700, Tigerstyle wrote: Hi guys. I'm strugglin with some homework stuff and am hoping you can help me out here. This is the code: small_words = ('into', 'the', 'a', 'of', 'at', 'in', 'for', 'on') def book_title(title): Takes a string and returns a

Re: Doctest failing

2011-09-10 Thread Chris Angelico
On Sat, Sep 10, 2011 at 10:24 PM, Alister Ware alister.w...@ntlworld.com wrote: Ignoring the docttests my process would be to process each word then manually capitalize he 1st word, .I would als0 use a comprehension as makes for cleaner code:- def capitalize(word):    if word in

Re: Doctest failing

2011-09-10 Thread Terry Reedy
On 9/10/2011 7:20 AM, Tigerstyle wrote: Hi guys. I'm strugglin with some homework stuff and am hoping you can help me out here. We appreciate you saying so instead of hiding that this is homework. small_words = ('into', 'the', 'a', 'of', 'at', 'in', 'for', 'on') def book_title(title):

Re: Doctest failing

2011-09-10 Thread Terry Reedy
On 9/10/2011 7:47 AM, Peter Otten wrote: You can work around that with a flag along these lines first = True for word in title_split: if first: # special treatment for the first word first = False else: # put checks for all words but the first here

Re: Doctest failing

2011-09-10 Thread Peter Otten
Terry Reedy wrote: On 9/10/2011 7:47 AM, Peter Otten wrote: You can work around that with a flag along these lines first = True for word in title_split: if first: # special treatment for the first word first = False else: # put checks for all

Re: Doctest failing

2011-09-10 Thread ting
On Sep 10, 7:47 am, Peter Otten __pete...@web.de wrote: Tigerstyle wrote: I'm strugglin with some homework stuff and am hoping you can help me out here. This is the code: small_words = ('into', 'the', 'a', 'of', 'at', 'in', 'for', 'on')     new_title = []     title_split =

[issue3979] Doctest failing when it should pass

2008-09-26 Thread J. Pablo Fernández
test in 0.000s OK Thank you. -- components: Library (Lib) files: failingdoctest.py messages: 73882 nosy: pupeno severity: normal status: open title: Doctest failing when it should pass versions: Python 2.5 Added file: http://bugs.python.org/file11624/failingdoctest.py