[Python-Dev] Warn about mktemp once again? (original) (raw)

"Martin v. Löwis" martin at v.loewis.de
Tue Apr 29 08:35:00 CEST 2008


Same here. In fact, is there a good reason to have mkstemp() return the fd (except backward compatibility)?

Except for backwards compatibility: is there a good reason to keep os.mkstemp at all?

The tradition is that all APIs in os expose the "system" calls as-is, i.e. they don't try to adjust the result values at all. This has the advantage that the caller can use their system's man page to find out all details, and trust that the Python wrapper does exactly the same.

For mkstemp, there are two special issues: the C API modifies the string parameter, which cannot be exposed to Python as-is (hence the two result values), and it isn't a system call (at least not on POSIX), so it doesn't really need to be exposed, except perhaps to also provide this on non-POSIX systems where a regular POSIX implementation (in Python) would fail.

Regards, Martin



More information about the Python-Dev mailing list