This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author r.david.murray
Recipients docs@python, ebianchi, r.david.murray
Date 2017-06-15.15:28:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1497540515.32.0.117366938956.issue30677@psf.upfronthosting.co.za>
In-reply-to
Content
We don't generally document all exceptions that a method can raise, only those that are relevant to its specific API.  In this case, documenting the exception answers the question, "what happens if the directory already exists?"  This question is relevant to the API since the other reasonable possibility is that it would act as if the mkdir had succeeded.  As for documenting OSError, I'm sure there are ways to get os.mkdir to raise an exception that is not an OSError.

However, there is an argument to be made for documenting FileNotFound: the other reasonable thing the function could do in that case would be to create all intermediate path parts, but it does not do that (you use os.makedirs for that).  Since os.makedirs is documented right after os.mkdir, I'm not sure it is worth adding, but one can make the argument :)
History
Date User Action Args
2017-06-15 15:28:35r.david.murraysetrecipients: + r.david.murray, docs@python, ebianchi
2017-06-15 15:28:35r.david.murraysetmessageid: <1497540515.32.0.117366938956.issue30677@psf.upfronthosting.co.za>
2017-06-15 15:28:35r.david.murraylinkissue30677 messages
2017-06-15 15:28:35r.david.murraycreate