"Phillip J. Eby" <[EMAIL PROTECTED]> wrote: > At 10:00 PM 1/9/2007 -0800, Josiah Carlson wrote: [snip] > Please provide what you'd put in the reference manual as an explanation of > this behavior. (Remember: if the implementation is hard to explain...)
If the name to the right of the 'as' keyword perpetuates beyond the end of the try/except/finally clause, it will be rebound to None before user code is executed further. > >The benefit to the above is that the name only disappears from the > >namespace if the user deletes it, otherwise the name is bound to None. > > Please explain how this is a benefit. By making any use of the name raise > an error, we ensure that you will detect your mistake early, whereas > binding the name to None may allow the value to be passed, stored, > returned, or otherwise used, with the problem not being detected until > later, when it may be much harder to trace back to the source. > > In other words, eliminating the error is *not* a benefit here. (Errors > should not pass silently.) I'm not sure that the error would pass silently for very long, as None can't really do a whole lot of things. Then again, any duration is probably too much, as you say. - Josiah _______________________________________________ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com
