[issue39291] "pathlib.Path.link_to()" and "pathlib.Path.symlink_to()" have reversed usage

2021-01-19 Thread yota moteuchi


yota moteuchi  added the comment:

one option to could be to create a hardlink_to() method which is 
link.hardlink_to(target) and in a few release, deprecate link_to ? :)

--
nosy: +yota moteuchi

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39291] "pathlib.Path.link_to()" and "pathlib.Path.symlink_to()" have reversed usage

2020-03-12 Thread Joannah Nanjekye


Joannah Nanjekye  added the comment:

Am hesitant on re-opening this.

I think it sounds more meaningful to open a new issue for the new
suggestion that requires deprecating this
current behavior and introducing the new intended functionality.

Best,
Joannah

On Thu, Mar 12, 2020 at 8:40 PM Barney Gale  wrote:

>
> Barney Gale  added the comment:
>
> Per discussion on the mailing list, I'd like to request that this bug be
> re-opened.
>
>
> https://mail.python.org/archives/list/python-...@python.org/thread/7QPLYW36ZK6QTW4SV4FI6C343KYWCPAT/
>
> --
> nosy: +barneygale
>
> ___
> Python tracker 
> 
> ___
>

-- 
Best,
Joannah Nanjekye

*"You think you know when you learn, are more sure when you can write, even
more when you can teach, but certain when you can program." Alan J. Perlis*

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39291] "pathlib.Path.link_to()" and "pathlib.Path.symlink_to()" have reversed usage

2020-03-12 Thread Barney Gale


Barney Gale  added the comment:

Per discussion on the mailing list, I'd like to request that this bug be 
re-opened.

https://mail.python.org/archives/list/python-...@python.org/thread/7QPLYW36ZK6QTW4SV4FI6C343KYWCPAT/

--
nosy: +barneygale

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39291] "pathlib.Path.link_to()" and "pathlib.Path.symlink_to()" have reversed usage

2020-01-10 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

Closing as won't fix.  If you feel strongly about this, I would suggest to 
bring the discussion on python-dev: 
https://mail.python.org/mailman3/lists/python-dev.python.org/

--
resolution:  -> wont fix
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39291] "pathlib.Path.link_to()" and "pathlib.Path.symlink_to()" have reversed usage

2020-01-10 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

Ahah. Nice catch!

Well, it's a pity this got overlooked when we added Path.link_to().  But I'm 
afraid it's late to change it now, since this has been released, and changing 
the argument order would break existing code in potentially dangerous ways.

Note the original issue where this was added was issue26978.

--
nosy: +nanjekyejoannah

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39291] "pathlib.Path.link_to()" and "pathlib.Path.symlink_to()" have reversed usage

2020-01-10 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +pitrou

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39291] "pathlib.Path.link_to()" and "pathlib.Path.symlink_to()" have reversed usage

2020-01-10 Thread Rockmizu


New submission from Rockmizu :

Python version: Python 3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 23:11:46) [MSC 
v.1916 64 bit (AMD64)] on win32

The usage of symlink_to() is link.symlink_to(target)
while the usage of link_to() is target.link_to(link).
This could be confusing.

Here is an example:

>>> import pathlib
>>> target = pathlib.Path('target.txt')
>>> p1 = pathlib.Path('symlink.txt')
>>> p2 = pathlib.Path('hardlink.txt')
>>> p1.symlink_to(target)
>>> p2.link_to(target)  # expected usage
Traceback (most recent call last):
  File "", line 1, in 
  File "D:\Program Files\Python38\lib\pathlib.py", line 1346, in link_to
self._accessor.link_to(self, target)
FileNotFoundError: [WinError 2] The system cannot find the file specified: 
'hardlink.txt' -> 'target.txt'
>>> target.link_to(p2)  # current usage
>>>

Since os.symlink() and os.link() have the same argument order,

>>> import os
>>> os.symlink('target.txt', 'symlink.txt')
>>> os.link('target.txt', 'hardlink.txt')
>>>

it would be nicer if the pathlib has the same argument order too.

--
components: Library (Lib)
messages: 359745
nosy: Rockmizu
priority: normal
severity: normal
status: open
title: "pathlib.Path.link_to()" and "pathlib.Path.symlink_to()" have reversed 
usage
type: behavior
versions: Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com