Also, as an extension of this idea, would it be possible to improve errors
like this:


class X: pass
X() # object() takes no parameters


to show the actual type instead of just 'object'?

On Tue, Oct 25, 2016 at 4:48 PM, Ryan Gonzalez <rym...@gmail.com> wrote:

> So, based on everyone's feedback, I just created this:
>
> http://bugs.python.org/issue28536
>
> On Mon, Oct 24, 2016 at 5:07 PM, Ryan Gonzalez <rym...@gmail.com> wrote:
>
>> I personally find it kind of annoying when you have code like this:
>>
>>
>> x = A(1, B(2, 3))
>>
>>
>> and Python's error message looks like this:
>>
>>
>> TypeError: __init__() takes 1 positional argument but 2 were given
>>
>>
>> It doesn't give much of a clue to which `__init__` is being called. At
>> all.
>>
>> The idea: when showing the function name in an error like this, show the
>> fully qualified name, like:
>>
>>
>> TypeError: A.__init__() takes 1 positional argument but 2 were given
>>
>>
>> This would be MUCH more helpful!
>>
>>
>> Another related change would be to do the same thing in tracebacks:
>>
>>
>> Traceback (most recent call last):
>>   File "<stdin>", line 1, in <module>
>>   File "<stdin>", line 2, in __init__
>> AssertionError
>>
>>
>> to:
>>
>>
>> Traceback (most recent call last):
>>   File "<stdin>", line 1, in <module>
>>   File "<stdin>", line 2, in MyClass.__init__
>> AssertionError
>>
>>
>> which could make it easier to find where exactly an error originated.
>>
>> --
>> Ryan (ライアン)
>> [ERROR]: Your autotools build scripts are 200 lines longer than your
>> program. Something’s wrong.
>> http://kirbyfan64.github.io/
>>
>>
>
>
>
> --
> Ryan (ライアン)
> [ERROR]: Your autotools build scripts are 200 lines longer than your
> program. Something’s wrong.
> http://kirbyfan64.github.io/
>
>



-- 
Ryan (ライアン)
[ERROR]: Your autotools build scripts are 200 lines longer than your
program. Something’s wrong.
http://kirbyfan64.github.io/
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to