New submission from Jim Sizelove <[EMAIL PROTECTED]>: PEPs 3109 and 3110 describe changes to Exceptions. The attached patch file makes changes to the tutorial to bring it in line with the changes to errors and exceptions implemented in Python 3.0.
I'll make a comment about the .args of exceptions instances. The tutorial states "use of .args is discouraged." I found, however, that the alternative of unpacking the args using __getitem__ raises a TypeError. >>> try: ... raise Exception('spam', 'eggs') ... except Exception as inst: ... x, y = inst ... Traceback (most recent call last): File "<stdin>", line 2, in <module> Exception: ('spam', 'eggs') During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<stdin>", line 4, in <module> TypeError: 'Exception' object is not iterable Does that mean that now .args is encouraged? ---------- assignee: georg.brandl components: Documentation files: errors.diff keywords: patch messages: 70876 nosy: georg.brandl, jsizelove severity: normal status: open title: Changes to exceptions not reflected in tutorial examples. type: behavior versions: Python 3.0 Added file: http://bugs.python.org/file11080/errors.diff _______________________________________ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue3525> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com