New submission from David Benjamin: This is somewhat of a nitpick. os.rename's documentation says "If dst is a directory, OSError will be raised". On Unix, this isn't completely true. If the source is a directory and the destination is an empty directory, it'll overwrite the former with the latter. (Actually if the source is a directory the inverse is true; if dst is a file, OSError will be raised.)
In [1]: import os In [2]: os.mkdir("aaa") In [3]: open("aaa/blah", "w").close() In [4]: os.mkdir("bbb") In [5]: os.rename("aaa", "bbb") In [6]: os.listdir("bbb") Out[6]: ['blah'] ---------- assignee: docs@python components: Documentation messages: 173285 nosy: David.Benjamin, docs@python priority: normal severity: normal status: open title: os.rename documentation slightly inaccurate type: enhancement versions: Python 2.7, Python 3.4, Python 3.5 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue16278> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com