[Python-Dev] os.path.walk() lacks 'depth first' option

Jeremy Fincher fincher.8@osu.edu
Mon, 21 Apr 2003 12:56:42 -0400


On Sunday 20 April 2003 10:12 pm, Tim Peters wrote:
>     if 'CVS' in dirs:
>         dirs.remove('CVS')

This code brought up an interesting question to me: if sets have a .discard 
method that removes an element without raising KeyError if the element isn't 
in the set, should lists perhaps have that same method?

On another related front, sets (in my Python 2.3a2) raise KeyError on a 
.remove(elt) when elt isn't in the set.  Since sets aren't mappings, should 
that be a ValueError (like list raises) instead?

Jeremy