mark benedetto king wrote:
> On Sat, Aug 23, 2003 at 11:43:22AM +0100, Max Bowsher wrote:
>> * tools/cvs2svn/cvs2svn.py (SymbolicNameTracker.bump_rev_count):
>> Use "for: ... else: ..." construct to render temporary variable
>> unnecessary.
>>
>> Index: cvs2svn.py
>> ===================================================================
>> --- cvs2svn.py (revision 6839)
>> +++ cvs2svn.py (working copy)
>> @@ -1310,20 +1310,17 @@
>> entry_val[revlist_key] = [(rev, 1)]
>> else:
>> rev_counts = entry_val[revlist_key]
>> - done = None
>> for i in range(len(rev_counts)):
>> this_rev, this_count = rev_counts[i]
>> if rev == this_rev:
>> rev_counts[i] = (this_rev, this_count + 1)
>> - done = 1
>> break
>> elif this_rev > rev:
>> if i > 0:
>> i = i - 1
>> rev_counts.insert(i, (rev, 1))
>> - done = 1
>> break
>> - if not done:
>> + else:
>> rev_counts.append((rev, 1))
>> entry_val[revlist_key] = rev_counts
>>
>
> Doesn't this change the semantics of the block?
No - The behaviour of "for: ... else: ..." is to execute the "else:" unless
the loop was exited by "break".
>
> For example, what if rev_counts contains only pairs of the form (x,y)
> where x < rev?
Then the loop terminates by exhaustion of things to loop over, and executes
the "else:" clause.
Max.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Aug 23 20:35:15 2003