[Tutor] Fwd: Can tempfile.NamedTemporaryFile(delete=False) be used to create *permanent* uniquely named files?
William Ray Wing
wrw at mac.com
Mon Oct 22 21:26:46 EDT 2018
> On Oct 22, 2018, at 8:30 PM, boB Stepp <robertvstepp at gmail.com> wrote:
> On Mon, Oct 22, 2018 at 11:57 AM Mats Wichmann <mats at wichmann.us> wrote:
>> On 10/22/18 8:24 AM, boB Stepp wrote:
>>> Forwarding to the Tutor list. Herr Maier offers a good idea that
>>> would take away much of a remaining issue -- the name "Temporary". I
>>> need to look into the functools library to see what "partial" does.
>> if you really don't care what the file is called because you will
>> maintain a map which leads you to the filename, you might as well use a
> Wouldn't I have to write a check to ensure such a named file (However
> unlikely that would be.) did not exist before creating it? And if
> yes, would not that get into the same potential security issue that
> cause tempfile.mktemp() to be deprecated?
The whole point of UUIDs is to make the probability of a UUID collision so infinitesimally small as to make that hypothetical collision simply not worth worrying about, even when they are created on different systems. Since a big chunk of a UUID is a high precision time stamp, any UUIDs created on a single system are pretty much guaranteed to be unique.
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
More information about the Tutor