[Python-Dev] Warn about mktemp once again?

"Martin v. Löwis" martin at v.loewis.de
Tue Apr 29 23:35:17 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?
> 
> Greg Ewing's use-case is one I've also had at times - ie. as a
> convenience function for creating a "somewhat temporary" file that is
> randomly named, but persists beyond the closing of the file.  If the
> function doesn't stay in os it doesn't make any difference to me
> though :-)

I was talking about the specific implementation, which happens to be
a wrapper around the C library's mkstemp. For the use case in
question, I think passing delete=False to NamedTemporaryFile would
work just as well.

Regards,
Martin


More information about the Python-Dev mailing list