Re: [Python-Dev] Error message for wrong number of arguments

2018-08-04 Thread Nick Coghlan
On 4 August 2018 at 05:34, Jeroen Demeyer wrote: > On 2018-07-30 17:28, Nick Coghlan wrote: >> >> I would, and I think it would make sense for the PEP to cite improving >> consistency (and reducing code duplication?) in that regard as an >> advantage of the PEP. > > > I'm not sure to which PEP

Re: [Python-Dev] Error message for wrong number of arguments

2018-08-03 Thread Jeroen Demeyer
On 2018-07-30 17:28, Nick Coghlan wrote: I would, and I think it would make sense for the PEP to cite improving consistency (and reducing code duplication?) in that regard as an advantage of the PEP. I'm not sure to which PEP you are referring (PEP 580 or a new PEP?). After thinking a bit

Re: [Python-Dev] Error message for wrong number of arguments

2018-08-03 Thread Jeroen Demeyer
Actually, scratch that, I posted too soon. There is also a block /*[clinic input] class list "PyListObject *" "_Type" [clinic start generated code]*/ So it could work. ___ Python-Dev mailing list Python-Dev@python.org

Re: [Python-Dev] Error message for wrong number of arguments

2018-08-03 Thread Jeroen Demeyer
Actually, I just realized that it's not really possible to fix the error messages for built-in methods. The problem is that Argument Clinic does not know whether a function or method is being handled. For example, there is no indication at all that this is a method (note that the name

Re: [Python-Dev] Error message for wrong number of arguments

2018-08-03 Thread Larry Hastings
On 08/01/2018 02:40 PM, Armin Rigo wrote: I think that argument clinic knows if the built-in function is supposed to be a method or a function. Yes, Argument Clinic knows.  Clinic's "Function" instances have a "cls" member, and if that's set to a Clinic "Class" instance--and it's not one

Re: [Python-Dev] Error message for wrong number of arguments

2018-08-02 Thread Chris Barker via Python-Dev
On Wed, Aug 1, 2018 at 2:40 PM, Armin Rigo wrote: > On 30 July 2018 at 22:19, Chris Barker via Python-Dev > wrote: > > Oh well. This is a serious usability issue -- but what can you do? > > I think that argument clinic knows if the built-in function is > supposed to be a method or a function.

Re: [Python-Dev] Error message for wrong number of arguments

2018-08-01 Thread Armin Rigo
Hi, On 30 July 2018 at 22:19, Chris Barker via Python-Dev wrote: > Oh well. This is a serious usability issue -- but what can you do? I think that argument clinic knows if the built-in function is supposed to be a method or a function. It doesn't look too hard to add a new flag METH_IS_METHOD

Re: [Python-Dev] Error message for wrong number of arguments

2018-07-30 Thread Chris Barker via Python-Dev
On Mon, Jul 30, 2018 at 11:39 AM, Jeroen Demeyer wrote: > On 2018-07-30 20:22, Chris Barker wrote: > >> is it possible for the interpreter to know when this error is >> generated that this is a bound method expecting a "self", rather than an >> arbitrary function with n parameters? >> > > That

Re: [Python-Dev] Error message for wrong number of arguments

2018-07-30 Thread Jeroen Demeyer
On 2018-07-30 20:22, Chris Barker wrote: is it possible for the interpreter to know when this error is generated that this is a bound method expecting a "self", rather than an arbitrary function with n parameters? That would be quite hard. The error message is generated by the underlying

Re: [Python-Dev] Error message for wrong number of arguments

2018-07-30 Thread Chris Barker via Python-Dev
On Mon, Jul 30, 2018 at 5:12 AM, Jeroen Demeyer wrote: > I think it has been argued before that it's a feature that self is > counted. I suppose it is, as it's technically correct, but it's also a HUGE source of confusion, particularly for newbies. IF this is being touched anyway, is it

Re: [Python-Dev] Error message for wrong number of arguments

2018-07-30 Thread Nick Coghlan
On 30 July 2018 at 22:12, Jeroen Demeyer wrote: > I think it has been argued before that it's a feature that self is counted. > So I consider the error message for list().append a bug. This is one of the > many oddities I noticed while working on improving built-in functions. > > Would you agree