~sschwarzer/ftputil#130: 
Consider making some arguments keyword-only

ftputil 4.0.0 will introduce backward-incompatible changes. One of these changes is dropping support for Python 2.

Since we're breaking backward compatibility anyway and no longer need to support Python 2, this is a good time to check which arguments should become keyword-only arguments.

Status
RESOLVED FIXED
Submitter
schwa (unverified)
Assigned to
No-one
Submitted
4 years ago
Updated
4 years ago
Labels
enhancement library

schwa (unverified) 4 years ago · edit

Some thoughts:

  • ftputil APIs that mimic Python standard library APIs in os, os.path etc. should behave the same as those standard library APIs. This rules out using keyword-only arguments in places where the Python standard library doesn't use them either.

  • Even if we could change other public ftputil APIs to use keyword-only arguments, there's no point in forcing users to "fix" their code for a minimally cleaner API. Only arguments that are added from now on may be keyword-only arguments.

  • As an exception to the previous two rules, keyword-only arguments make sense for arguments that ftputil added or adds on top of the arguments in the standard library. This would prevent ambiguity in positional arguments if the Python standard library introduces new arguments in existing functions/methods and users want to use the arguments added by the standard library as positional arguments.

  • This leaves the introduction to keyword-only arguments to internal ftputil APIs, i. e. undocumented APIs that aren't supposed to be used by client code.

schwa (unverified) 4 years ago · edit

I only made very few arguments keyword-only arguments and don't plan to make any more such changes at the moment: cd658614f9d6aea63283101318717e198aaab378 and 0aff51c552bc8540d24d15d6b5e8e05511e72a81.

Register here or Log in to comment, or comment via email.