Skip to content
Browse files

explicit for-loop in cleanup_kernels

makes single-iteration clearer than while loop, as reviewed by @fperez.
  • Loading branch information...
1 parent 14bb294 commit 0f2a7ee3f4c1756ca8cee30c428b953fa8ea0fb0 @minrk committed Jan 5, 2012
Showing with 3 additions and 2 deletions.
  1. +3 −2 IPython/frontend/html/notebook/
5 IPython/frontend/html/notebook/
@@ -367,8 +367,9 @@ def cleanup_kernels(self):
"""'Shutting down kernels')
km = self.kernel_manager
- while km.kernel_ids:
- km.kill_kernel(km.kernel_ids[0])
+ # copy list, since kill_kernel deletes keys
+ for kid in list(km.kernel_ids):
+ km.kill_kernel(kid)
def start(self):
ip = self.ip if self.ip else '[all ip addresses on your system]'

2 comments on commit 0f2a7ee

fperez commented on 0f2a7ee Jan 6, 2012

I'm glad the function is called kill_kernel and not kill, otherwise that last line would read pretty darkly ;) Thanks!

minrk commented on 0f2a7ee Jan 6, 2012

Indeed it would. I hadn't seen that.

Please sign in to comment.
Something went wrong with that request. Please try again.