Ben Finney added the comment:

> I have read the thread on Python-list

Thank you, and thanks for linking to that discussion.

> and still don't understand the purpose of your idea.

The purpose is to get a public API for making temporary filesystem paths with 
the same properties as are produced by ‘tempfile’, specifically as produced by 
a ‘tempfile._get_candidate_names’ generator.

The paths will be used in unit tests and will never touch the filesystem.

Some have suggested using ‘uuid’ or other random-generator APIs. Using an API 
that isn't explicitly designed to produce valid filesystem paths is both risky 
(the algorithm may not exactly produce the right behaviour), and confusing (a 
reader seeing use of an unrelated API will not find it obvious why that API was 
used for generating a filesystem path).

The unit tests need paths with properties that are already implemented in 
‘tempfile’, so it seems unreasonable to suggest that functionality should be 
re-implemented elsewhere since it is already in the standard library.

The request is for a “get the next path generated by a 
‘tempfile._get_candidate_names’ generator”, with an approved and documented 
public API. One suggested name is ‘tempfile.makepath’.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue26362>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to