[Python-Dev] PEP 463: Exception-catching expressions

Eric V. Smith eric at trueblade.com
Sat Feb 22 13:22:17 CET 2014


On 2/22/2014 6:27 AM, Antoine Pitrou wrote:
> On Sat, 22 Feb 2014 22:13:58 +1100
> Chris Angelico <rosuav at gmail.com> wrote:

>> Lib/inspect.py:1350:
>>     return sys._getframe(1) if hasattr(sys, "_getframe") else None
>> becomes
>>     return (sys._getframe(1) except AttributeError: None)
> 
> May hide a bug if sys._getframe(1) itself raises AttributeError.

return (sys._getframe except AttributeError: lambda i: None)(1)

Assuming I have the syntax correct, and the bindings work this way, of
course.


More information about the Python-Dev mailing list