Re: [Python-ideas] shutil.symlink to allow non-race replacement of existing link targets

2019-05-13 Thread Anders Hovmöller
> On 14 May 2019, at 04:24, Steven D'Aprano wrote: > > It's not "cryptic" that Paris, France is difference from Paris, Texas. > Let's not abuse the word "cryptic" for things which are easy to resolve. I'm sorry I thought you were the one arguing FOR using the same word for two very

Re: [Python-ideas] shutil.symlink to allow non-race replacement of existing link targets

2019-05-13 Thread Anders Hovmöller
> On 14 May 2019, at 04:24, Steven D'Aprano wrote: > > *wink*. Function names are mnemonics, not documentation. Certainly not with that attitude. But it easily could be. Maybe you would be fine with a language where all function names are just hex values? *wink* (yes I think this was rude

Re: [Python-ideas] shutil.symlink to allow non-race replacement of existing link targets

2019-05-13 Thread Stephen J. Turnbull
Steven D'Aprano writes: > Of course it is enough to presume that if they come from different > modules, they are probably different unless proven otherwise. That mere presumption is not helpful because YOLO. Most of us have limited time, and that includes doc-reading time. > As I have

Re: [Python-ideas] shutil.symlink to allow non-race replacement of existing link targets

2019-05-13 Thread Anders Hovmöller
> On 14 May 2019, at 03:33, Steven D'Aprano wrote: > >> On Tue, May 14, 2019 at 12:22:05AM +0300, Serge Matveenko wrote: >> >> As a regular library user, I see and expect no obvious difference >> between `os.symlink` and `shutil.symlink`. > > You "see ... no obvious difference" between two

Re: [Python-ideas] (meta) Broken link to gmane.org archive of python-ideas

2019-05-13 Thread Brett Cannon
Bugs about the website should be reported to https://github.com/python/pythondotorg . On Mon, May 13, 2019 at 7:42 AM Tom Hale wrote: > On 13/5/19 5:21 pm, Steven D'Aprano wrote: > > If you don't like the mailman archives here > > > > https://mail.python.org/pipermail/python-ideas/ > > > > you

Re: [Python-ideas] shutil.symlink to allow non-race replacement of existing link targets

2019-05-13 Thread Steven D'Aprano
On Tue, May 14, 2019 at 11:43:32AM +0900, Stephen J. Turnbull wrote: [...] > > Isn't the fact that they live in *different modules* obvious > > enough? > > Please, Steve, you didn't need to go there. > > Because it's not enough. Of course it is enough to presume that if they come from

Re: [Python-ideas] shutil.symlink to allow non-race replacement of existing link targets

2019-05-13 Thread Stephen J. Turnbull
Steven D'Aprano writes: > On Tue, May 14, 2019 at 12:22:05AM +0300, Serge Matveenko wrote: > > > As a regular library user, I see and expect no obvious difference > > between `os.symlink` and `shutil.symlink`. > > You "see ... no obvious difference" between two functions that live in >

Re: [Python-ideas] shutil.symlink to allow non-race replacement of existing link targets

2019-05-13 Thread Steven D'Aprano
On Mon, May 13, 2019 at 08:23:34PM +0200, Anders Hovmöller wrote: > > Being found in different modules should always be treated as a sign that > > the functions may be different. (If they're the same, why do we need > > both?) > > Assuming all users know there is another. How do users know

Re: [Python-ideas] shutil.symlink to allow non-race replacement of existing link targets

2019-05-13 Thread Steven D'Aprano
On Tue, May 14, 2019 at 12:22:05AM +0300, Serge Matveenko wrote: > As a regular library user, I see and expect no obvious difference > between `os.symlink` and `shutil.symlink`. You "see ... no obvious difference" between two functions that live in completely different modules? Isn't the fact

Re: [Python-ideas] shutil.symlink to allow non-race replacement of existing link targets

2019-05-13 Thread Serge Matveenko
On Mon, May 13, 2019 at 9:24 PM Anders Hovmöller wrote: > > On 13 May 2019, at 19:38, Steven D'Aprano wrote: > >> On Mon, May 13, 2019 at 12:31:08PM +0200, Anders Hovmöller wrote: > >> An optional "overwrite_if_exists=False" flag seems much nicer. > > > > Aside from the argument name being too

Re: [Python-ideas] shutil.symlink to allow non-race replacement of existing link targets

2019-05-13 Thread Anders Hovmöller
> On 13 May 2019, at 19:38, Steven D'Aprano wrote: > >> On Mon, May 13, 2019 at 12:31:08PM +0200, Anders Hovmöller wrote: >> >> >>> On 13 May 2019, at 11:38, Tom Hale wrote: >>> >>> * os.symlink() - the new link name is expected to NOT exist >>> * shutil.symlink() - the new symlink

Re: [Python-ideas] shutil.symlink to allow non-race replacement of existing link targets

2019-05-13 Thread Steven D'Aprano
On Mon, May 13, 2019 at 04:38:08PM +0700, Tom Hale wrote: > As suggested by Toshio Kuratomi at https://bugs.python.org/issue36656, I > am raising this here for inclusion in the shutil module. > > Mimicking POSIX, os.symlink() will raise FileExistsError if the link > name to be created already

Re: [Python-ideas] shutil.symlink to allow non-race replacement of existing link targets

2019-05-13 Thread Steven D'Aprano
On Mon, May 13, 2019 at 12:31:08PM +0200, Anders Hovmöller wrote: > > > > On 13 May 2019, at 11:38, Tom Hale wrote: > > > > * os.symlink() - the new link name is expected to NOT exist > > * shutil.symlink() - the new symlink replaces an existing file > > This seems error prone to me. There is

Re: [Python-ideas] (meta) Broken link to gmane.org archive of python-ideas

2019-05-13 Thread Tom Hale
On 13/5/19 5:21 pm, Steven D'Aprano wrote: If you don't like the mailman archives here https://mail.python.org/pipermail/python-ideas/ you might try ActiveState: https://code.activestate.com/lists/python-ideas/ Would https://bugs.python.org/ be an appropriate place for suggesting the

Re: [Python-ideas] Break multiple loop levels

2019-05-13 Thread haael
How about doing it pythonic way then, "everything is a hack on a symbol table". Let normal loops remain normal loops. Let's introduce a special construction: > for x in iterator as loop_control_object: > loop_body(loop_control_object) The iterator in the loop would be wrapped inside

Re: [Python-ideas] (meta) Broken link to gmane.org archive of python-ideas

2019-05-13 Thread Stefan Krah
On Mon, May 13, 2019 at 08:21:59PM +1000, Steven D'Aprano wrote: > Alas, Gmane is only a shadow of its former self. Most of the archives > are either lost or simply not restored. It is also worth pointing put that the "new" communication modes like Discourse, Slack or Gitter have no decent

Re: [Python-ideas] shutil.symlink to allow non-race replacement of existing link targets

2019-05-13 Thread Anders Hovmöller
> On 13 May 2019, at 11:38, Tom Hale wrote: > > * os.symlink() - the new link name is expected to NOT exist > * shutil.symlink() - the new symlink replaces an existing file This seems error prone to me. There is nothing about those names that hint at the difference in behavior. An optional

Re: [Python-ideas] (meta) Broken link to gmane.org archive of python-ideas

2019-05-13 Thread Steven D'Aprano
On Mon, May 13, 2019 at 04:37:16PM +0700, Tom Hale wrote: > Heya all, > > I've joined this list and wanted to read the archives to get a flavour > of the community here. > > I noticed that the link with text: > >gmane.org archive of python-ideas Alas, Gmane is only a shadow of its former

[Python-ideas] shutil.symlink to allow non-race replacement of existing link targets

2019-05-13 Thread Tom Hale
As suggested by Toshio Kuratomi at https://bugs.python.org/issue36656, I am raising this here for inclusion in the shutil module. Mimicking POSIX, os.symlink() will raise FileExistsError if the link name to be created already exists. A common use case is overwriting an existing file (often a

[Python-ideas] (meta) Broken link to gmane.org archive of python-ideas

2019-05-13 Thread Tom Hale
Heya all, I've joined this list and wanted to read the archives to get a flavour of the community here. I noticed that the link with text: gmane.org archive of python-ideas on the page: https://www.python.org/community/lists/ gives a HTML page with the only text being: Page

Re: [Python-ideas] Path conversion for f-strings

2019-05-13 Thread Serge Matveenko
On Mon, May 13, 2019 at 4:44 AM Batuhan Taskaya wrote: > > Like repr and string the file system path is used alot and something like > path!p might be handy. > > >>> class MyClass: > ... def __fspath__(self): > ... return "/home/batuhan" > ... > >>> assert f"{mc!p}" ==