[issue29467] Allow return mismatch to be caught by function

2017-02-06 Thread Eric V. Smith
Eric V. Smith added the comment: Thanks for the suggestion. However, I don't think it's possible or desirable for python to implement this. There are two problems: 1) the internals of python would have to be drastically changed to support this, and 2) you'd need different syntax to support

[issue29467] Allow return mismatch to be caught by function

2017-02-06 Thread Ted Shaneyfelt
New submission from Ted Shaneyfelt: def f(): try: return 0 except: return 1,2 x = f() # x is 0 x,y = f() # proposal: x,y should be 1,2 instead of uncaught TypeError It would make sense to be able to catch [TypeError: 'int' object is not iterable] and return the correct number of