On Tue, Oct 25, 2016 at 04:55:21PM -0500, Ryan Gonzalez wrote:
> 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'?
My wild guess is that the cause is that __new__ looks like this:
class object():
def __new__(cls, *args):
if args:
raise TypeError('object() takes no parameters')
Except in C, of course.
This is probably a left-over from the days when object() took and
ignored any parameters. If my guess is close, then maybe we can do this:
if args:
raise TypeError('%s() takes no parameters' % cls.__name__)
or equivalent.
--
Steve
_______________________________________________
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/