On 29/06/17 19:00, eryk sun wrote:
> On Thu, Jun 29, 2017 at 6:50 AM, Steven D'Aprano wrote:
>> try:
>> something
>> except:
>> exc_type, exc, tb = sys.exc_info()
>> print(traceback.extract_tb(tb))
>> raise
>>
>> Why does it return the exception type separately from the exception,
On 2017-06-29 19:19, Thomas Jollans wrote:
[snip]
Ah, Python history.
Back in the old days, it was possible to raise strings instead of the
classes that took over later.
Python 2.4.6 (#1, Jun 29 2017, 19:23:06)
[GCC 5.4.0 20160609] on linux4
Type "help", "copyright", "credits" or "license" for
On 29/06/17 08:50, Steven D'Aprano wrote:
> sys.exc_info() returns three items:
>
> (exception type, exception value, traceback)
>
> https://docs.python.org/2/library/sys.html#sys.exc_info
>
> https://docs.python.org/3/library/sys.html#sys.exc_info
>
>
>
> and may be used something like this
On Thu, Jun 29, 2017 at 6:50 AM, Steven D'Aprano wrote:
> try:
> something
> except:
> exc_type, exc, tb = sys.exc_info()
> print(traceback.extract_tb(tb))
> raise
>
> Why does it return the exception type separately from the exception, when
> the type can be derived by calling `ty