He was talking about

  raise ExceptionClass

which I don't want to forbid; it's the

  raise ExceptionClass, args

that will be killed in 3.0. You're correct though that in 2.x, "raise
E" instantiates E immediately. We could change this though, as it
works from C...

--Guido

On 3/13/07, Thomas Wouters <[EMAIL PROTECTED]> wrote:
>
>
> On 3/13/07, Guido van Rossum <[EMAIL PROTECTED]> wrote:
> > >
> > > Would this apply to Python code as well? I.e. if you use
> > > a raise statement with a class, it doesn't get instantiated
> > > immediately? And if you catch it with an except clause which
> > > doesn't capture the exception, it's never instantiated?
> > > That would be a bonus.
> >
> > I *think* that's how it works now, and I don't intend to break this.
>
> Eh, I don't see how it can, when you do 'raise ExceptionClass(args)' (like
> you want everyone to use :). It certainly doesn't, now; the arguments to
> 'raise' are just expressions, there is no specialcasing of calling anything.
> I don't believe it does so with the two-argument raise either -- at least,
> when experimenting, the body of an exception class's __init__ method is
> executed before the body of a 'finally' suite.
>
> --
> Thomas Wouters <[EMAIL PROTECTED]>
>
> Hi! I'm a .signature virus! copy me into your .signature file to help me
> spread!


-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)
_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to