On 02/26/2013 06:30 PM, Terry Reedy wrote:
On 2/26/2013 1:47 PM, Larry Hastings wrote:
I think positional-only functions should be discouraged, but we don't

If I were writing something like Clinic, I would be tempted to not have that option. But I was actually thinking about something in the positional-only writeup that mentioned the possibility of adding something to the positional-only option.

Clinic needs to be usable for every builtin in order to be a credible solution.  And the positional-only approach to parsing is sufficiently different from the positional-and-keywords approach that I couldn't sweep the conceptual difference under the rug--I had to explicitly support weird stuff like optional positional arguments on the left.  So I really don't have a choice.  All we can do is say "please don't use this for new code".

As I understand it, C module files are structured something like the following, which is 'unusual' for a python file.

def meth1_impl(...

def meth2_impl(...

class C:
  meth1 = meth1_impl
  meth2 = meth2_impl

At the moment Clinic is agnostic about where in Python the callable lives.  The "module name" in the DSL is really just used in documentation and to construct the name of the static functions.  So if you specify a class name as your "module name" it'll work fine and look correct.  However, maybe we need to think about this a little more when it comes time to add Signature metadata.


/arry