R. David Murray added the comment:

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 :)

----------
nosy: +r.david.murray

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30677>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to