On 9/17/13 2:56 PM, Skip Montanaro wrote:
I have a function which uses for ... else, with an early return.
Here's a cut down version of it:
"""..."""
def func(c, dt, ct):
for cl, op in zip(c.events[0::2], c.events[1::2]):
delta = cl.event_datetime - dt
if delta > ct:
I have a function which uses for ... else, with an early return.
Here's a cut down version of it:
"""..."""
def func(c, dt, ct):
for cl, op in zip(c.events[0::2], c.events[1::2]):
delta = cl.event_datetime - dt
if delta > ct:
return dt + ct
else:
On 9/17/13 7:56 PM, Skip Montanaro wrote:
> But this "else" is useless, isn't it? Just put the "return dt"
statement after the for statement, no else needed.
In this particular case, yes, but that's not the point of the post.
Pylint doesn't check to see what's in the else clause, only whet
Ned,
I still think you're missing the point of my original post. A return
is as good as a break when considering early exit from a loop. The
pylint code only checks for the presence of a break statement, but the
test cases clearly show a case with a return statement. The test
functions even includ
> But this "else" is useless, isn't it? Just put the "return dt" statement
> after the for statement, no else needed.
In this particular case, yes, but that's not the point of the post.
Pylint doesn't check to see what's in the else clause, only whether
there is an early exit from the body of th
On 18 September 2013 02:39, Skip Montanaro wrote:
> Ned,
>
> I still think you're missing the point of my original post. A return
> is as good as a break when considering early exit from a loop. The
> pylint code only checks for the presence of a break statement, but the
> test cases clearly show
On 18 septembre 05:33, Michael Foord wrote:
> On 18 September 2013 02:39, Skip Montanaro wrote:
> > I still think you're missing the point of my original post. A return
> > is as good as a break when considering early exit from a loop. The
> > pylint code only checks for the presence of a break st