Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #102939

Re: Make a unique filesystem path, without creating the file

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Ben Finney <ben+python@benfinney.id.au>
Newsgroups comp.lang.python
Subject Re: Make a unique filesystem path, without creating the file
Date Mon, 15 Feb 2016 16:25:24 +1100
Lines 41
Message-ID <mailman.129.1455513940.22075.python-list@python.org> (permalink)
References <85r3gf55k4.fsf@benfinney.id.au> <CAG93HwHjKewu-VHUUc1jL=cU-pDNxVtKxx6ORyr+mdLLSJx2TA@mail.gmail.com> <CAG93HwGRsvcc=9rGgOA=oi6C-3pTk-Kr3g4dxCN0ivvixTVPWw@mail.gmail.com> <mailman.121.1455494940.22075.python-list@python.org> <n9r8bk$evf$1@dont-email.me> <mailman.126.1455499198.22075.python-list@python.org> <56c15a25$0$1622$c3e8da3$5496439d@news.astraweb.com>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 8bit
X-Trace news.uni-berlin.de 58Ty+yOmPJHI+1gRRqI9PAicyvrTnIJR/7qEdnKY32lQ==
Cancel-Lock sha1:6KcMsyeo+iV4VvIQ2bINZ5FuMv0=
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.019
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'api.': 0.04; 'deprecated': 0.07; 'subject:file': 0.07; 'api': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'undocumented': 0.09; 'duplicating': 0.16; 'filesystem,': 0.16; 'forking': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'string': 0.17; 'removed.': 0.18; 'library': 0.20; 'saying': 0.22; 'examples': 0.24; 'implemented': 0.24; 'url:bugs': 0.24; 'header:User-Agent:1': 0.26; 'header:X -Complaints-To:1': 0.26; 'correct': 0.28; 'looks': 0.29; "i'm": 0.30; 'code': 0.30; 'probably': 0.31; 'reported': 0.32; 'useful': 0.33; 'url:python': 0.33; "d'aprano": 0.33; 'everyone.': 0.33; 'steven': 0.33; 'advice': 0.35; 'ahead': 0.35; 'fail': 0.35; 'but': 0.36; 'url:org': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'subject:the': 0.39; 'enough': 0.39; 'to:addr:python.org': 0.40; 'some': 0.40; 'your': 0.60; 'real': 0.62; 'skip:n 10': 0.62; 'is.': 0.63; 'request.': 0.66; 'concerns': 0.66; 'worth': 0.67; 'day': 0.67; '_o__)': 0.84; 'received:125': 0.84; 'scary': 0.84; 'absolutely': 0.88; 'skip:\xe2 30': 0.91; 'subject:Make': 0.91; '8bit%:18': 0.93; 'good,': 0.93
X-Injected-Via-Gmane http://gmane.org/
X-Gmane-NNTP-Posting-Host jigong.madmonks.org
X-Public-Key-ID 0xAC128405
X-Public-Key-Fingerprint 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405
X-Public-Key-URL http://www.benfinney.id.au/contact/bfinney-pubkey.asc
X-Post-From Ben Finney <bignose+hates-spam@benfinney.id.au>
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.21rc2
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:102939

Show key headers only | View raw


Steven D'Aprano <steve+comp.lang.python@pearwood.info> writes:

> If you can absolutely guarantee that this string will never actually
> be used on a real filesystem, then go right ahead and use it.

I'm giving advice in examples in documentation. It's not enough to have
some private usage that I know is good, I am looking for a standard API
that when the reader looks it up will not be laden with big scary
warnings.

Currently I can write about the public API ‘tempfile.mktemp’ in
documentation, but the conscientious reader will be correct to have
concerns when the examples I give are sternly deprecated in the standard
library documentation.

Or I can write about the private API ‘tempfile._RandomNameSequence’ in
the documentation, and the conscientious reader will be correct to have
concerns about use of an undocumented private-use API.

I'm looking for a way to give examples that use that standard library
functionality, with an API that is both public and not discouraged.

> > I'm looking for how to get at that functionality in a non-deprecated
> > way, without re-implementing it myself.
>
> You probably can't, not if you want to future-proof your code against
> the day when tempfile.mktemp is removed.

That's disappointing. It is already implemented and well-tested, it is
useful as is. Forking and duplicating it is poor practice if it can
simply be used in a standard place.

I have reported <URL:https://bugs.python.org/issue26362> for this
request.

-- 
 \     “Nothing worth saying is inoffensive to everyone. Nothing worth |
  `\    saying will fail to make you enemies. And nothing worth saying |
_o__)            will not produce a confrontation.” —Johann Hari, 2011 |
Ben Finney

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: Make a unique filesystem path, without creating the file Ben Finney <ben+python@benfinney.id.au> - 2016-02-15 11:08 +1100
  Re: Make a unique filesystem path, without creating the file Dan Sommers <dan@tombstonezero.net> - 2016-02-15 01:07 +0000
    Re: Make a unique filesystem path, without creating the file Ben Finney <ben+python@benfinney.id.au> - 2016-02-15 12:19 +1100
      Re: Make a unique filesystem path, without creating the file Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2016-02-15 15:54 +1100
        Re: Make a unique filesystem path, without creating the file Ben Finney <ben+python@benfinney.id.au> - 2016-02-15 16:25 +1100
        Re: Make a unique filesystem path, without creating the file Rick Johnson <rantingrickjohnson@gmail.com> - 2016-02-15 18:26 -0800
      Re: Make a unique filesystem path, without creating the file Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2016-02-15 21:00 +1300
        Re: Make a unique filesystem path, without creating the file Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-02-16 01:18 +0100
      Re: Make a unique filesystem path, without creating the file Grant Edwards <invalid@invalid.invalid> - 2016-02-15 15:49 +0000
  Re: Make a unique filesystem path, without creating the file Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2016-02-15 15:06 +1100
    Re: Make a unique filesystem path, without creating the file Ben Finney <ben+python@benfinney.id.au> - 2016-02-15 15:28 +1100
      Re: Make a unique filesystem path, without creating the file Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2016-02-15 21:11 +1300
      Re: Make a unique filesystem path, without creating the file Nobody <nobody@nowhere.invalid> - 2016-02-16 02:14 +0000
    Re: Make a unique filesystem path, without creating the file "Martin A. Brown" <martin@linux-ip.net> - 2016-02-14 20:48 -0800

csiph-web