While the example is valid, I doubt that it is in any sense 
"common" case.  OTOH the language will allow strange mess of
reserved words with '...', that hurts readability and 
even gives you an instrument to write tangled and obscured code.

Most of the python code is readable in plain english, that's
something a lot of people fond of.  I can't read 'raise from ...'
or 'raise from Ellipsis', and I even had mixed understanding of
it after reading the PEP.

It's much more than a simple behaviour of "raise from None" 
(which many of us eagerly want).

I'm -1 on adding 'raise from ...'.

On 2012-02-03, at 11:52 AM, Ethan Furman wrote:

> Yury Selivanov wrote:
>> Re "raise ValueError from ..."
>> So what does it mean now?  Just resetting __cause__ to make __context__ 
>> printed?
> 
> Whatever __cause__ was before (None, or an actual exception), it is now 
> Ellipsis -- so __context__ will be printed and the exception chain will be 
> followed.
> 
>> Can you show the down-to-earth snippet of code where such syntax would be 
>> useful?
> 
> Not sure I'll ever use it this way, but:
> 
> try:
>  try:
>    raise IndexError()
>  except:
>    raise CustomError() from None
> except CustomError as e:
>  # nevermind, let's see the whole thing after all
>  raise e from Ellipsis
> 
> ~Ethan~

_______________________________________________
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

Reply via email to