[Python-Dev] Re: pathlib.Path: inconsistent symlink_to() and link_to()

2021-01-22 Thread Brett Cannon
On Thu, Jan 21, 2021 at 4:43 PM Barney Gale  wrote:

> Hi Brett,
>
> Per your PR review feedback [0] I left a comment on the bug [1] asking
> when the link_to() method should be scheduled for removal. It didn't elicit
> a great deal of feedback, so I'm raising this again here!
>

Per PEP 387 (https://www.python.org/dev/peps/pep-0387/), the deprecation
needs to last for at least 2 versions (so if this landed in 3.10 then
removal couldn't happen any sooner than 3.12).


>
> The proposed deprecation warning in the docs currently reads:
>
> > This method is deprecated in favor of :meth:`Path.hardlink_to`, as its
> argument order does not match that of :meth:`Path.symlink_to`.
>

I would replace "its argument order" with "the argument order of
:meth:`link_to` to disambiguate what "its" is referring to (my brain kept
associating it with the last noun, which was Path.hardlink_to).


>
> My view is that the removal does not need to happen soon. Any existing
> code will be written by people who have already figured out the argument
> reversal, so the current situation doesn't seem dangerous. That said, a
> speedy deprecation and replacement will remove a guaranteed headache for
> people creating hardlinks in pathlib.
>

The removal can't be any _sooner_ than 3.12, but it can be postponed if
desired/necessary.


>
> Apologies if replying to an old thread is bad form - I'm not well versed
> in mailing list etiquette.
>

Not a problem! Sometimes it's just called for, and you kept the old emails
quoted in your reply which helps.

-Brett


>
> Best,
>
> Barney
>
> [0] https://github.com/python/cpython/pull/18909#discussion_r392416154
> [1] https://bugs.python.org/issue39950#msg365275
>
> On Wed, 11 Mar 2020 at 17:31, Brett Cannon  wrote:
>
>> Antoine Pitrou wrote:
>> > On Wed, 11 Mar 2020 11:17:22 +
>> > Barney Gale barney.g...@gmail.com wrote:
>> > > Hi,
>> > > Pathlib's symlink_to() and link_to() methods have different argument
>> > > orders, so:
>> > > a.symlink_to(b)  # Creates a symlink from A to B
>> > > a.link_to(b)  # Creates a hard link from B to A
>> > >
>> > > I don't think link_to() was intended to be implemented this way, as
>> the
>> > > docs say "Create a hard link pointing to a path named target.". It's
>> also
>> > > inconsistent with everything else in pathlib, most obviously
>> symlink_to().
>> > > Bug report here: https://bugs.python.org/issue39291
>> > > This /really/ irks me. Apparently it's too late to fix link_to(), so
>> I'd
>> > > like to suggest we add a new hardlink_to() method that matches the
>> > > symlink_to() argument order. link_to() then becomes
>> deprecated/undocumented.
>> > > I think that's a good idea.
>>
>> +1 from me as well; new method and deprecate the old one.
>>
>> > Regards
>> > Antoine.
>> ___
>> Python-Dev mailing list -- python-dev@python.org
>> To unsubscribe send an email to python-dev-le...@python.org
>> https://mail.python.org/mailman3/lists/python-dev.python.org/
>> Message archived at
>> https://mail.python.org/archives/list/python-dev@python.org/message/EID35RFJJQBHL4WKSO5DM36O7DDVDEKP/
>> Code of Conduct: http://python.org/psf/codeofconduct/
>>
>
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/6IOGUMHE7AMJGBJ3KKLMQJU4EJDBYPEL/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: pathlib.Path: inconsistent symlink_to() and link_to()

2021-01-21 Thread Barney Gale
Hi Brett,

Per your PR review feedback [0] I left a comment on the bug [1] asking when
the link_to() method should be scheduled for removal. It didn't elicit a
great deal of feedback, so I'm raising this again here!

The proposed deprecation warning in the docs currently reads:

> This method is deprecated in favor of :meth:`Path.hardlink_to`, as its
argument order does not match that of :meth:`Path.symlink_to`.

My view is that the removal does not need to happen soon. Any existing code
will be written by people who have already figured out the argument
reversal, so the current situation doesn't seem dangerous. That said, a
speedy deprecation and replacement will remove a guaranteed headache for
people creating hardlinks in pathlib.

Apologies if replying to an old thread is bad form - I'm not well versed in
mailing list etiquette.

Best,

Barney

[0] https://github.com/python/cpython/pull/18909#discussion_r392416154
[1] https://bugs.python.org/issue39950#msg365275

On Wed, 11 Mar 2020 at 17:31, Brett Cannon  wrote:

> Antoine Pitrou wrote:
> > On Wed, 11 Mar 2020 11:17:22 +
> > Barney Gale barney.g...@gmail.com wrote:
> > > Hi,
> > > Pathlib's symlink_to() and link_to() methods have different argument
> > > orders, so:
> > > a.symlink_to(b)  # Creates a symlink from A to B
> > > a.link_to(b)  # Creates a hard link from B to A
> > >
> > > I don't think link_to() was intended to be implemented this way, as the
> > > docs say "Create a hard link pointing to a path named target.". It's
> also
> > > inconsistent with everything else in pathlib, most obviously
> symlink_to().
> > > Bug report here: https://bugs.python.org/issue39291
> > > This /really/ irks me. Apparently it's too late to fix link_to(), so
> I'd
> > > like to suggest we add a new hardlink_to() method that matches the
> > > symlink_to() argument order. link_to() then becomes
> deprecated/undocumented.
> > > I think that's a good idea.
>
> +1 from me as well; new method and deprecate the old one.
>
> > Regards
> > Antoine.
> ___
> Python-Dev mailing list -- python-dev@python.org
> To unsubscribe send an email to python-dev-le...@python.org
> https://mail.python.org/mailman3/lists/python-dev.python.org/
> Message archived at
> https://mail.python.org/archives/list/python-dev@python.org/message/EID35RFJJQBHL4WKSO5DM36O7DDVDEKP/
> Code of Conduct: http://python.org/psf/codeofconduct/
>
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/3MCTZLLCZ2WGVPDW6R5RK7YNL7WK52D6/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: pathlib.Path: inconsistent symlink_to() and link_to()

2020-03-11 Thread Brett Cannon
Antoine Pitrou wrote:
> On Wed, 11 Mar 2020 11:17:22 +
> Barney Gale barney.g...@gmail.com wrote:
> > Hi,
> > Pathlib's symlink_to() and link_to() methods have different argument
> > orders, so:
> > a.symlink_to(b)  # Creates a symlink from A to B
> > a.link_to(b)  # Creates a hard link from B to A
> > 
> > I don't think link_to() was intended to be implemented this way, as the
> > docs say "Create a hard link pointing to a path named target.". It's also
> > inconsistent with everything else in pathlib, most obviously symlink_to().
> > Bug report here: https://bugs.python.org/issue39291
> > This /really/ irks me. Apparently it's too late to fix link_to(), so I'd
> > like to suggest we add a new hardlink_to() method that matches the
> > symlink_to() argument order. link_to() then becomes deprecated/undocumented.
> > I think that's a good idea.

+1 from me as well; new method and deprecate the old one.

> Regards
> Antoine.
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/EID35RFJJQBHL4WKSO5DM36O7DDVDEKP/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: pathlib.Path: inconsistent symlink_to() and link_to()

2020-03-11 Thread Antoine Pitrou
On Wed, 11 Mar 2020 11:17:22 +
Barney Gale  wrote:
> Hi,
> 
> Pathlib's symlink_to() and link_to() methods have different argument
> orders, so:
> 
> a.symlink_to(b)  # Creates a symlink from A to B
> a.link_to(b)  # Creates a hard link from B to A
> 
> I don't think link_to() was intended to be implemented this way, as the
> docs say "Create a hard link pointing to a path named target.". It's also
> inconsistent with everything else in pathlib, most obviously symlink_to().
> 
> Bug report here: https://bugs.python.org/issue39291
> 
> This /really/ irks me. Apparently it's too late to fix link_to(), so I'd
> like to suggest we add a new hardlink_to() method that matches the
> symlink_to() argument order. link_to() then becomes deprecated/undocumented.

I think that's a good idea.

Regards

Antoine.

___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/7BL6FK4ZFVBMGKIMZA53ODDO3H5CN5HJ/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: pathlib.Path: inconsistent symlink_to() and link_to()

2020-03-11 Thread James Edwards
Despite the bug being closed as WONTFIX, at the very least this seems like
a valid docs issue.  But (for whatever a non-core-dev opinion is worth),
I'm +1 both on the proposed solution and deprecation.of `link_to()`

Jim

On Wed, Mar 11, 2020 at 10:45 AM Barney Gale  wrote:

> Hi,
>
> Pathlib's symlink_to() and link_to() methods have different argument
> orders, so:
>
> a.symlink_to(b)  # Creates a symlink from A to B
> a.link_to(b)  # Creates a hard link from B to A
>
> I don't think link_to() was intended to be implemented this way, as the
> docs say "Create a hard link pointing to a path named target.". It's also
> inconsistent with everything else in pathlib, most obviously symlink_to().
>
> Bug report here: https://bugs.python.org/issue39291
>
> This /really/ irks me. Apparently it's too late to fix link_to(), so I'd
> like to suggest we add a new hardlink_to() method that matches the
> symlink_to() argument order. link_to() then becomes deprecated/undocumented.
>
> Any thoughts?
>
> Barney
> ___
> Python-Dev mailing list -- python-dev@python.org
> To unsubscribe send an email to python-dev-le...@python.org
> https://mail.python.org/mailman3/lists/python-dev.python.org/
> Message archived at
> https://mail.python.org/archives/list/python-dev@python.org/message/7QPLYW36ZK6QTW4SV4FI6C343KYWCPAT/
> Code of Conduct: http://python.org/psf/codeofconduct/
>
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/5T2D3CUEC6E5PG3ZMLHMAI4N2B2NL7TI/
Code of Conduct: http://python.org/psf/codeofconduct/