Message246664
I have a question about this new snippet in choice():
+ if i == n and n > 0:
+ i = n - 1
What's the purpose of the "and n > 0" clause? Without it, if i == n == 0 then i will be set to -1, which is just as good as 0 for the purpose of raising IndexError (seq[any_int] raises IndexError when seq is empty). |
|
Date |
User |
Action |
Args |
2015-07-12 19:36:54 | tim.peters | set | recipients:
+ tim.peters, rhettinger, mark.dickinson, pitrou, vstinner, steven.daprano, r.david.murray, skrah, serhiy.storchaka, Serge Anuchin |
2015-07-12 19:36:54 | tim.peters | set | messageid: <1436729814.63.0.700149795099.issue24567@psf.upfronthosting.co.za> |
2015-07-12 19:36:54 | tim.peters | link | issue24567 messages |
2015-07-12 19:36:54 | tim.peters | create | |
|