os.remove & os.rmdir

Padraig Brady padraig.brady at corvil.com
Tue Jan 7 10:55:42 EST 2003


Peter Hansen wrote:
> Padraig Brady wrote:
>>I just want
>>the simple change to allow remove() to work on empty directories.
>>Actually I don't see any backwards compatability probs at all.
> 
> Hmmm... might there not be code which uses os.remove() with the
> assumption it is not going to remove anything which is an empty
> directory?

True but not likely and anyway most would use unlink.

> Maybe this is just the reinterpretation of the direction
> I was going, after correcting my confusion.  I suspect any change
> to the behaviour of these functions could lead to a situation
> where existing code behaves very badly.

I can't think of an example where you would remove(dir)
willy nilly unless you can to delete the whole tree anyway
and then it's not an issue.

Pádraig.





More information about the Python-list mailing list