>
>
> In general Python error messages don't include the relevant values or much 
> information about them, although I often wish they would. For example when I 
> get a KeyError I wish I could see which keys are present, unless there's too 
> many for it to be practical. I'm speculating, but I think there are two main 
> reasons for this:
>
> 1. To avoid executing arbitrary __repr__ methods.
> 2. To avoid the performance cost of creating a message for an exception that 
> may be caught and thrown away.
>
> Neither of these really apply to int('45f').
>
> Are there any other major reasons for the general lack of information? It 
> feels like an intentional decision beyond implementation difficulty. I 
> imagine we can work around both reasons:
>
> 1. There's a lot of information that can be extracted and displayed without 
> running any user defined code.
> 2. Objects can be saved (such as the dict that raised KeyError) while 
> deferring the message rendering until it's requested.


Yes there is, IPython used to display values of local frame variables
by default, though some of these values for some users were secrets
that ended up in logs files.
So even base types are sensitive and I don't think we should print
them by default.

Well you say what about interactive sessions ? Surely it's fine !

...Unless you are doing a demo at a conference and you end up printing
your AWS key in a live broadcast...

Though I'm definitively for having more informations displayed, even
if some of that is opt-in. With rich reprs in Jupyter we could
actually show variable values on hover with the mouse, or in a
collapsible html element.
-- 
Matthias
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/HUJ6NSC5ISTIST3ND6FBGXEUHU5VLVYX/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to