need dict to maintain order
aahz at panix.com
Sun Jan 20 00:55:29 EST 2002
In article <mailman.1011499888.13384.python-list at python.org>,
Jason Orendorff <jason at jorendorff.com> wrote:
>In this *particular* case I think it's unambiguously better.
>If the directory exists, it's foolish to try to create it again;
>if it *doesn't* exist, and you try to create it, and fail
>(permission denied; or device failure), then it's foolish to
>proceed and start putting files in that directory. Right?
One of the stock arguments in favor of try/except in cases like this is
that your test/create sequence is not an atomic operation. Therefore
you need to wrap os.mkdir() in a try/except *anyway* (not even talking
about potential problems such as lack of permissions), so why bother
doing the test in the first place?
--- Aahz <*> (Copyright 2002 by aahz at pobox.com)
Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/
Androgynous poly kinky vanilla queer het Pythonista
"I support family values -- Addams family values" --www.nancybuttons.com
More information about the Python-list