[docs] Bug in `itertools.combinations` documentation (equivalent function)

bob gailer bgailer at gmail.com
Sat Mar 23 23:59:38 CET 2013


On 3/21/2013 4:43 PM, Vladislav Zorov wrote:
> Hello, dear documentation maintainers!
>
> Present in     : all versions of the documentation (2.6.8 - 3.4.0)
> Example URL: 
> http://docs.python.org/3.4/library/itertools.html#itertools.combinations
> Description    : The `else: return` part is incorrectly indented on 
> the same level as `for`, thus appearing to be part of the `while` loop.
>
> while True:
>         for i in reversed(range(r)):
>             if indices[i] != i + n - r:
>                 break
>         else:
>             return
>
> Thank you for giving me so, so much to read! I hope I didn't 
> misunderstand the code
Seems you did.

for_stmt ::=  "for" target_list "in" expression_list ":" suite ["else" 
":" suite]

A break <simple_stmts.html#break> statement executed in the first suite 
terminates the loop without executing the else <#else> clause's suite..

> - forgive me if I did.
OK

-- 
Bob Gailer
919-636-4239
Chapel Hill NC

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/docs/attachments/20130323/b16b5609/attachment.html>


More information about the docs mailing list