Opened 3 months ago

Closed 3 months ago

#130 closed enhancement (fixed)

Consider making some arguments keyword-only

Reported by: schwa Owned by: schwa
Priority: minor Milestone:
Component: Library Version: 4.0.0
Keywords: keyword-only arguments, backward compatibility Cc:


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.

Change History (2)

comment:1 Changed 3 months ago by schwa

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.

comment:2 Changed 3 months ago by schwa

Resolution: fixed
Status: assignedclosed

I only made very few arguments keyword-only arguments and don't plan to make any more such changes at the moment: [3c3ac50e0334] and [eb173e9673db].

Note: See TracTickets for help on using tickets.