Make a unique filesystem path, without creating the file

Grant Edwards invalid at invalid.invalid
Mon Feb 15 10:49:36 EST 2016


On 2016-02-15, Ben Finney <ben+python at benfinney.id.au> wrote:
> Dan Sommers <dan at tombstonezero.net> writes:
>
>> On Mon, 15 Feb 2016 11:08:52 +1100, Ben Finney wrote:
>>
>> > I am unconcerned with whether there is a real filesystem entry of
>> > that name; the goal entails having no filesystem activity for this.
>> > I want a valid unique filesystem path, without touching the
>> > filesystem.
>>
>> That's an odd use case.
>
> It's very common to want filesystem paths divorced from accessing a
> filesystem entry.

If the filesystem paths are not associated with a filesystem, what do
you mean by "unique"?  You want to make sure that path <whatever>
which doesn't exist in some filesystem is different from all other
paths that don't exist in some filesystem?

> For example: test paths in a unit test. Filesystem access is orders
> of magnitude slower than accessing fake files in memory only,

How is "fake files in memory" not a filesystem?

-- 
Grant Edwards               grant.b.edwards        Yow! The Korean War must
                                  at               have been fun.
                              gmail.com            



More information about the Python-list mailing list