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> wrote:
> Dan Sommers <dan at> 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.

More information about the Python-list mailing list