Breaking out of walk()

Kelly Lynn Martin kelly at poverty.bloomington.in.us
Sun Jan 16 21:52:38 EST 2000


On Sun, 16 Jan 2000 16:36:10 GMT, rjroy at takingcontrol.com (Robert Roy) said:

>Make sure you modify the list in-place. Don't do names=[] since that
>creates a reference to a different object. You can also choose not to
>recurse through certain directories.

That doesn't break out of walk entirely; it will still continue to
recurse through higher-level directories.  It just prunes.

If you want a complete abort, throwing an exception is the only way I
can think of to get out.

Kelly




More information about the Python-list mailing list