Error handling in context managers

Gregory Ewing greg.ewing at canterbury.ac.nz
Tue Jan 17 00:01:54 EST 2017


Terry Reedy wrote:
> Traceback (most recent call last):
>   File "<pyshell#3>", line 1, in <module>
>     with None: pass
> AttributeError: __enter__

Like he said, you get an AttributeError!

-- 
Greg



More information about the Python-list mailing list