Re: [Python-Dev] What this code should do?

2008-09-19 Thread Michael Foord

Maciej Fijalkowski wrote:

Hello,

I'm a little clueless about exact semantics of following snippets:

http://paste.pocoo.org/show/85698/

is this fine?
  


It looks right to me. :-)

In the first case the NameError is caught by the except and not 
re-raised (but still enters the finally after the except block) and in 
the second the NameError is caught by the finally that does re-raise.


What do you think should happen?

Michael


or shall I fill the bug?
(the reason to ask is because a) django is relying on this b) pypy
implements it differently)

cheers,
fijal
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/fuzzyman%40voidspace.org.uk
  



--
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/
http://www.trypython.org/
http://www.ironpython.info/
http://www.resolverhacks.net/
http://www.theotherdelia.co.uk/

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] What this code should do?

2008-09-19 Thread Alexander Shigin
В Птн, 19/09/2008 в 17:43 +0200, Maciej Fijalkowski пишет:
 Hello,
 
 I'm a little clueless about exact semantics of following snippets:
 
 http://paste.pocoo.org/show/85698/
 
 is this fine?
 or shall I fill the bug?
 (the reason to ask is because a) django is relying on this b) pypy
 implements it differently)

It seems ok. The exception is raised in except clause and it doesn't
handle by any except.

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] What this code should do?

2008-09-19 Thread Amaury Forgeot d'Arc
Hello Maciej,

Maciej Fijalkowski wrote:
 Hello,

 I'm a little clueless about exact semantics of following snippets:

 http://paste.pocoo.org/show/85698/

 is this fine?
 or shall I fill the bug?
 (the reason to ask is because a) django is relying on this b) pypy
 implements it differently)

Note that python 3.0 has a different behaviour; in the first sample, it prints:
A (class 'NameError' ...
B (class 'ZeroDivisionError', ...

See the subtle differences between
http://docs.python.org/dev/library/sys.html#sys.exc_info
http://docs.python.org/dev/3.0/library/sys.html#sys.exc_info

-- 
Amaury Forgeot d'Arc
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] What this code should do?

2008-09-19 Thread Jean-Paul Calderone

On Fri, 19 Sep 2008 18:26:05 +0200, Amaury Forgeot d'Arc [EMAIL PROTECTED] 
wrote:

Hello Maciej,

Maciej Fijalkowski wrote:

Hello,

I'm a little clueless about exact semantics of following snippets:

http://paste.pocoo.org/show/85698/

is this fine?
or shall I fill the bug?
(the reason to ask is because a) django is relying on this b) pypy
implements it differently)


Note that python 3.0 has a different behaviour; in the first sample, it prints:
A (class 'NameError' ...
B (class 'ZeroDivisionError', ...

See the subtle differences between
http://docs.python.org/dev/library/sys.html#sys.exc_info
http://docs.python.org/dev/3.0/library/sys.html#sys.exc_info



The second example changes its behavior, too.  It gives back the NameError
from the exc_info call.  I'm having a hard time reconciling this with the
Python 3.0 documentation.  Can you shed some light?

Jean-Paul
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] What this code should do?

2008-09-19 Thread Maciej Fijalkowski
On Fri, Sep 19, 2008 at 9:30 PM, Jean-Paul Calderone [EMAIL PROTECTED] wrote:
 On Fri, 19 Sep 2008 18:26:05 +0200, Amaury Forgeot d'Arc
 [EMAIL PROTECTED] wrote:

 Hello Maciej,

 Maciej Fijalkowski wrote:

 Hello,

 I'm a little clueless about exact semantics of following snippets:

 http://paste.pocoo.org/show/85698/

 is this fine?
 or shall I fill the bug?
 (the reason to ask is because a) django is relying on this b) pypy
 implements it differently)

 Note that python 3.0 has a different behaviour; in the first sample, it
 prints:
 A (class 'NameError' ...
 B (class 'ZeroDivisionError', ...

 See the subtle differences between
 http://docs.python.org/dev/library/sys.html#sys.exc_info
 http://docs.python.org/dev/3.0/library/sys.html#sys.exc_info


 The second example changes its behavior, too.  It gives back the NameError
 from the exc_info call.  I'm having a hard time reconciling this with the
 Python 3.0 documentation.  Can you shed some light?

 Jean-Paul


I think in python 2.x it's at least against the principle of least
surprise. It should not behave differently. The behavior of python 3
though it's even against docs :-/
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com