Uh oh!
There was an error while loading. Please reload this page.
Add Type to bad args output - #518
Conversation
dean0x7d
commented
Nov 21, 2016
What about using |
jagerman
commented
Nov 21, 2016
@dean0x7d - you mean simply instead of the type + value pair? I thought it might be nice to have both type and value, even if it is redundant sometimes (like None, Pet). |
But yeah, perhaps just |
dean0x7d
commented
Nov 21, 2016
Yeah, just |
While it's nicer than |
jagerman
commented
Nov 21, 2016
@pschella - thoughts? |
dean0x7d
commented
Nov 21, 2016
In most cases >>> import datetime
>>> now = datetime.datetime.now()
>>> str(now)
2016-11-21 21:32:47.664461
>>> repr(now)
datetime.datetime(2016, 11, 21, 21, 32, 47, 664461)
>>> then =eval(repr(now))
>>> str(then)
2016-11-21 21:32:47.664461The examples in the tests are mostly builtin types which can be trivially reconstructed. That's why >>> s ="hello"
>>> str(s)
hello
>>> repr(s)
'hello'
>>> eval(str(s))
NameError: name 'hello' is not defined
>>> eval(repr(s))
hello |
This gives more informative output, often including the type (or at least some hint about the type).
be6f5e9 to
f0ee877CompareOkay, I'm convinced :) Updated to just switch to |
The changes the error message for invalid arguments to display
Type (= strvalue)instead of juststrvaluefor the given argument list.Fixes#517.