On 11 March 2010 18:05, Robert Bradshaw <[email protected]> wrote:
> On Mar 11, 2010, at 12:58 PM, Lisandro Dalcin wrote:
>
>> On 11 March 2010 17:42, Robert Bradshaw
>> <[email protected]> wrote:
>>>
>>> As for the refnanny ones,
>>>
>>> http://hg.cython.org/cython-devel/rev/3045d63c5f14
>>>
>>
>> Can you explain me the magics behind:
>>
>> try:
>>    ....
>> except object, e:
>>   .....
>>
>> I cannot get it ...
>
>
> In Python 2.5+, all errors that are raised are subclasses of
> BaseException, but that doesn't exist in 2.3 or 2.4, hence "object"
> which will catch anything (and still give us the e).

What are you talking about? See this:

[dalc...@trantor tmp]$ cat exc.pyx
def main():
    try:
        raise ValueError
    except object, e:
        pass
[dalc...@trantor tmp]$ python -c 'import pyximport;
pyximport.install(); import exc; exc.main()'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "exc.pyx", line 3, in exc.main
(/u/dalcinl/.pyxbld/temp.linux-i686-2.6/pyrex/exc.c:430)
    raise ValueError
ValueError


>  The nested try is
> because the action of getting and storing e may cause an exception
> (though this shouldn't ever come up in practice).
>

Yes, I understand that part.


-- 
Lisandro Dalcin
---------------
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to